Friday, September 26, 2014

Update: Dev version should load from zip file in future:

Message to team members: Found bug that broke the doors in the dev version. Working on fixing it now. Eventually this will be fixed. Though booting up the dev version of the game takes way too long. For now, something you'll have to deal with. But on my list is to make the game load levels from zip files to make the loading go faster. The reason the game loads so slow currently is because the game has to "guess and check" to see if the files exist. Because flash is NOT allowed to see all the files in a directory. However, flash can see all the files in zip file.

Thursday, September 11, 2014

FIXED: VerifyError: Error #1068: int and * cannot be reconciled

//THIS SIMPLE CODE WILL CAUSE A STACK DUMP IN AS3:
//[Fault] exception, information=VerifyError: Error #1068: int and * cannot be reconciled.
private static function stackDump():void
{ 
 //obj can be an object, dictionary, vector, array.
 //probably anything that can be accessed using bracket notation.
 var obj:Array = [1, 2];
 var dex:int = 0;

 //if you access an object,vector,array,or dictionary using a nested incrimentor operator
 //followed by a continue statement, you will get a stack dump.
 //The loop can be a for, while, or do loop.
 while (false)
  {
  obj[dex++] = 0;
  continue;
  }

}//end stackDump


How do you fix it?
The problem is caused by using a continue statement after accessing an object using a nested increment operator on a variable.
Change the code inside the loop to:

dex++;
obj[dex] = 0;
continue;

OR:

obj[dex] = 0;
dex++;
continue;


Whichever one has the logic you are going for.


private static function stackDumpFIXED():void
{ 
 //obj can be an object, dictionary, vector, array.
 //probably anything that can be accessed using bracket notation.
 var obj:Array = [1, 2];
 var dex:int = 0;

 //if you access an object,vector,array,or dictionary using a nested incrimentor operator
 //followed by a continue statement, you will get a stack dump.
 //The loop can be a for, while, or do loop.
 while (false)
 {
  dex++;
                obj[dex] = 0;
                continue;
 }

}//end stackDump

Wednesday, September 10, 2014

I am getting stack dumps. And I am not happy.

Putting reference material to read up on this. Possibly a bug in flash, not my code. Ran on my other computer fine. Yet the build here fails... http://www.kongregate.com/forums/4-programming/topics/96607-as3-warning-stack-dump-verifyerror-error-1068-int-and-cannot-be-reconciled

AS3 Import Fails At Compile Time

My game was compiling fine on my other computer. I brought over the code base to another computer and tried to compile, and one of my imports was not found at compile time. The import was recognized by intellisense... But not when I tried to compile. I renamed a class from "TileMapCreationKeyGAS.as" to "TMCKey.as" And all of the sudden the import started working. I have NO CLUE why that worked. My thought: I know in HAXE if you name folders with capital letters, it thinks that is where the import stops because of the "Constant-Class" convention. Possibly my code was causing a parsing error at compile time? Maybe the "AS" at the end of the file name caused it to be parsed as: TileMapCreationKeyG.as instead of TileMapCreationKeyGAS.as I havent a clue. Frustrated. Unfocused.

Saturday, September 6, 2014

C# WebService accessing database on same server

I don't seem to know what I am doing. But I know what I want. And there is a lot of info to help. Will pick up here tomorrow: http://www.sqlcourse.com/create.html http://stackoverflow.com/questions/8362835/web-service-built-in-c-sharp-to-retrieve-data-from-mysql-database what is this: OleDbConnection Example: http://social.msdn.microsoft.com/Forums/en-US/9f5ae21c-c1d3-4037-93c3-c0cc8cc4214c/how-to-retrieve-data-from-database-via-web-service?forum=csharplanguage //http://www.sqlcourse.com/intro.html Basic SQL Commands: Select Insert Update Create Delete I am liking this! http://www.sqlcourse.com/select.html

Get Soap Based (XML) webservice working on non-local machines:

I was looking for the answer to this forever! Actually, more like, 1.5 hours. But still. SOURCE:http://bytes.com/topic/c-sharp/answers/492987-web-service-invoke-button-missing Jennifer, you need to explicitly enable whatever protocols are to be allowed from a remote machine in the web.config (There are additional entries beyond what is shown below): ... ... ... -- Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com UnBlog: http://petesbloggerama.blogspot.com "Jennifer" wrote: Well, I'm not sure about that. Like I said, it's worked fine before. But thanks for the thought! Thanks, Jennifer

Tuesday, July 22, 2014

Straight Ahead Programming - When to do it

When to straight ahead program:
1. The task is very simple and you have a very clear vision of the final product.
2. The task is more complex, but you've done it before.
   You are re-writing it for practice, and in hopes of doing it better this time.

When to plan ahead:
1. The task is very complex and you are not sure what to do.

Sometimes it is impossible to work out everything on paper. The devil is in the details.
Sometimes... Writing straight-ahead the first time could be considered "planning" for the
2nd time you write the code. It really depends on how much time you have on your hands and
how important it is to get things perfect.

I tend to only plan when I am looking at the bigger picture of how everything fits together.

For example... While writing this I am contemplating a very important re-factor of my code.
Not sure exactly what needs to change. But I think I need a GlobalAppStateRegistry.as that will
keep track of the global state of the game from the time it opens.

Maybe I need to approach the problem with a better attitude...

Whatever refactored solution I come up with today will be much better than the current system in place.
Iteration approaches perfection, but never reaches it. And that is okay.

Skull of the Shogun

Ran into a girl who's brother does game development while I was swing dancing. skull of the shogun looks pretty cool.

Friday, July 18, 2014

Level Editors and Seizures

A bare bones level editor is almost finished. At the core, we make levels via editing paint files. But we would like to make a more user-friendly editor that anyone can use. The editor needs to be good enough that it replaces our current method of making levels. I mean, how awesome would it be to say: "Buy our level editor! The very level editor used by our studio!" In other news: Don't click this if you are epileptic: Seizure warning. It's awesome. http://adamferriss.com/nze/

GRVC Design Pattern

My extension to a classic "model-view-controller" design pattern: Example: My tile-map class: G = Geometry Model. (Which tiles are where on the tilemap) R = Render Model. (How should different tiles be rendered?) V = View. (Uses the geometry model and render model to create an internal view on a buffer object) C = Controller. (A basic controller. Maybe better though of as API? It has no UI plugged into it. But has basic commands for editing the tilemap. Maybe should rename it as GRAV (GeomModle,RenderModel,API,View) Sample of the sprite-map I am working on for the level editor:
package JM_LIB.toolSystems.levelEditor.leMap 
{
 import JM_LIB.toolSystems.levelEditor.leMap.components.spriteHandle.SpriteRecMap_LEM;
 import JM_LIB.toolSystems.levelEditor.leMap.components.spriteHandle.SRMapBasicController;
 import JM_LIB.toolSystems.levelEditor.leMap.components.spriteHandle.SRMapRenModel;
 import JM_LIB.toolSystems.levelEditor.leMap.components.spriteHandle.SRMapView_LEM;
 /**
  * 
  * My own design pattern: GRVC:
  * G.R.V.C. - Geom-model.Render-Model.view.Basic-Controller.
  * 
  * Contains everything you need to render, edit, and save a sprite map.
  * DOES NOT contain any UI or display object container to display the buffer though!
  * @author JMIM
  */
 public class LeSpriteCore 
 {
  /** A basic controller that handles basic sprite setting API.
   *  Also references the _view, _ren, and _geon so it can re-draw stuff after edits are made to the map with the controller. **/
  private var _ctrl:SRMapBasicController;
  
  /** A render model that tells us how different sprite recs should be rendered. **/
  private var _ren:SRMapRenModel;
  
  /** View object that renders our geom **/
  private var _view:SRMapView_LEM;
  
  /** The sprite map geometry. No render data. Just tells us what is where. **/
  private var _geom:SpriteRecMap_LEM;
  
  public function LeSpriteCore() 
  {
   
  }
  
 }//class
}//package

Thursday, June 12, 2014

Deviant Art Stats

Used this to make the graph: http://www.onlinecharttool.com/graph?selected_graph=bar

Friday, March 7, 2014

Mochibot and lighting fix

One of my alternate forks/builds of the game has the lighting crashing in it. 
For some reason, the lighting fails to properly initialize when reg-recs are put into a level.
Figure out why.

Also, Signed up for MochiBot.
Going to get some analytic into the game so I can survey my testers.

// MochiBot.com -- Version 8
// Tested with Flash 9-10, ActionScript 3
MochiBot.track(this, "STUFFksjfljsf");


Also: This guy has made good edits to MochiBot from what I gather.
Though I am new to this, but I am coming back here later once I have set up Mochibot and done some
test runs.

http://philprogramming.blogspot.com/

-MakeGamesHappen
(-John Mark)

Sunday, March 2, 2014

This metal one Matt

Hiatus

Bad Review:

So, I think I should make a blog dedicated to my bad reviews. I say this because I do need hyper critical feedback to keep the game at a certain level of excellence. ----------------------------------
Not good. All you do is move around, and you've got this whole bomberman tribute aesthetic to work with? Seriously? You should rework your entire focus, man. I mean, the whole "fragile character running about to the exit in a small level" is so overdone and boring... and executed far better than here. I mean, all you have is switches and spamming fixed bombs everywhere. You need to stop that. It gets dull real fast. This is not puzzling at all for one, and the lack of variety results in levels that are just more of the same thing, and that's lame. And glaringly when large objects fall they don't do so properly. They stutter. STUTTER! As they are falling! Do you know how amateurish that looks? Here's where I think you should go: make it more a bomberman tribute. Have your character be able to place bombs. Make things more destructible as a result. Have chain reaction destruction, sure, you can go over the top with the feedback. In fact, I encourage it. But don't allow it to act as a "yay level solved just like that - just head on through to the exit buddy". Have the player struggle to MAKE HIS OWN PATH through whatever scenario he is in as much as possible. If you do that you won't be stuck with the problem of levels being designed around one obvious solution and as a result your game will be more PUZZLING and therefore more INTERESTING. Include live elements that the player can manipulate (and bait) to their advantage, like enemies that walk around and also shoot bombs when you are near them, enemies that run up to you and are bombs and will suicide explode onto you, and turrets that you can destroy. The more the player is allowed to manipulate the environment, the more fun you can make your game. It's good that you are trying to make things visceral with the lighting effects but that's not enough. Ramp it up to sensory overload. Have a dynamic camera that zooms in and out and shakes in regards to explosions like in Tankman: Incursion: http://www.newgrounds.com/portal/view/493636 In fact, take into account the graphics of that game as well. Exaggerated pixelation is not good pixel art. You really really need to improve your graphics everywhere. Make it so that the environment around you is more animated. A good place to start is to look at how megaman executes animated tiles. Have a background, not just an abstract space. Ideally, set the aesthetic in a clean futuristic city that ends up getting wrecked with destruction as the player provides onslaught against everything in his way. Provide indoor and outdoor environments that are larger than single screen rooms. Have parallax scrolling where necessary and do not have generic exits: again, look at how megaman does progression. Levels ideally require the player to fight through in all manner of directions, not just progressing right. You make it clear where the player has to go through a combination of aesthetic elements. Ramp up the gore. I like how blood stains the walls. Have a nice gory explosion rather than a lame zoom in and fade to black. Provide satisfaction from killing enemies with explosions and blood and gore as well. Get rid of the "obnoxious attitude" completely. It doesn't help you AT ALL and never will. I'm talking about death taunts, lame humour and whatever gets in the way of being badass. Also, have more business sense and be more ambitious than merely looking for sponsorship. This is what I think you should do to take what you have so far and make a hit title. It's up to you whatever you want to do, because I understand that what I said requires a lot of work and expertise. I have said all I have to say on this project.

Friday, February 28, 2014

New Lights. New Beta!

Additions:
1:
The lighting has been enhanced. There may be some lag issues that happen
during the breaking of light fixtures. Depends on how fast your computer is.
I will be working on fixing this. There are, in general, just a lot of optimizations
I need to make.
2:
Lights have been added to a majority of JoshicusLD's levels to show off the changes
to the lighting. There is nothing new about the levels besides this.

Fixes:
1. Pause during other menus works.
2. Flares do not come out of bricks when bashing them.
3. Do not go back to starting menu when dying on level#1
4. Weird Focus Glitch on start of game fixed.

Friday, February 21, 2014

Wednesday, February 19, 2014

JSONSolidifier

So, I was working on getting the new lighting integrated into the game, and gave up for 2 days to make this:

I sometimes go on coding side-projects when I am spending days coding something that I will see ZERO results until finished. It kinda keeps my moral up and keeps me interested. If I am not interested or passionate, I do not code well. So better to take on a coding side project and be productive, than to work slowly on what I should be doing. Anyways. Now I need to finish my JSONSolidifier than will automate the conversion of a .JSON file into a concrete class. Once that is done, I will be able to export my lighting presets into the final game. Once lighting presets are exported into the game... The game is going to look 1000x better. It will also play better because it addresses some visibility issues. :)

Tuesday, February 18, 2014

Tuesday, February 11, 2014

Gameception

This image was created using the pre-loader minigame for MakeChoice.
The strategy:
1. Use this minigame to make fractal art we can post to deviant art.
2. Provide a link that says : 
"I made this image with MakeChoice" (link to game.)

They think they are playing with a fractal art creator, 
but they are really playing with a mini-game in the 
pre-loader of MakeChoice. When the game is done loading, 
they are abruptly brought to the level select screen.
If we've got their attention this far... 
They might be curious to know what more is in store for them.
Or maybe they will just be angry that their art is lost.

But hopefully if they get angry, they leave me a comment!! 
Any publicity is good publicity.

Sunday, February 9, 2014

SandWiched Lighting and Bitmap Hijacker Class

Further progress on Matt's lighting tool.
The lighting system has been abstracted in 
a way that allows me to extract the 
plasma and lumen layers and draw
them at different times.

Now need to put in the SAVE feature for this.

After that... 
I have 2 more controls I want to 
add to our preset controller:
1: Alpha of bombs sprites control.
2: Alpha of tilemap control


How will I do this?
I will make a bitmapHijacker class.
It will hijack a bitmap reference, 
and make an INTERNAL UNALTERED copy of it.

THEN it will use the 
INTERNAL UNALTERED copy 
as a template used to 
ALTER the original hijacked bitmap.

Lighting Refactor Thoughts

In order to get the plasma and lumen layers 
drawing at different z-depths.... 
We will need to attach the object's layers
to FlxObject*s.

Right now both layers are part of the SAME flx object...

This is going to be a difficult refactor, 
but should really help out nailing down
better lighting presets without
requiring more CPU cycles.

Saturday, February 8, 2014

Lighting Changes

Working on a lighting tool for my artist. By creating different lighting presets we can make the lighting awesome yet keep the visuals clear.

Joshicus

BETA #3 -Joshicus

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.