tag:blogger.com,1999:blog-23431329449107200692024-03-05T14:47:52.406-08:00Time To FlashPolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.comBlogger162125tag:blogger.com,1999:blog-2343132944910720069.post-3648220131999175412014-11-08T06:47:00.000-08:002014-11-08T06:47:02.441-08:00Test Object for static method AS3var obj:Object = new DecalMetaDatumLE();<br /> var str:String = getQualifiedClassName( obj );<br /> var def:Class = getDefinitionByName(str) as Class;<br /> <br /> if (def["toJSONText"] != null)<br /> {<br /> trace("call it!");<br /> }<br /><br /><br />Still not sure how to list off all the static methods of a class.<br />But this is all I need for now. The ability to check for an object having a static method.<br />Making an advanced JSONEncoder where all complex data types can specify a<br />"toJSONText" and "fromJSONText" public static method that my JSONEncoder and JSONDecoder<br />will look for to better serialize complex objects. PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-53486262756122415652014-09-25T13:48:00.002-07:002014-09-25T13:48:28.459-07:00Adobe Flash Player 10.0 r2 has stopped working<br />I had to painstakingly trace through all my code until I found where the crash was happening.<br />The offending line?<br /><br />trace(this);<br /><br />I've been noticing that I get weird hard to find bugs every time I target a different version of flash.<br />Which now makes me know why I have testers who are reporting weird crashes that I cannot replicate.<br />
<br />
-MakeGamesHappen<br />(-John Mark)PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-61534970968681275172014-07-17T02:43:00.003-07:002014-07-17T02:43:47.706-07:00VerifyError: Error #1014: Class flash.ui::GameInput could not be found.https://github.com/HaxeFlixel/flixel/issues/901<br />
<br />
Answer:<br />
<div class="comment-content">
<div class="edit-comment-hide">
<div class="comment-body markdown-body markdown-format js-comment-body">
Yeah.. I expect we're gonna get this a lot from now on.<br />
We added flash gamepad support, which requires flash player version 11.8+. So there are two things you can do:<br />
<ol class="task-list">
<li>Increase the flash player version accordingly: <code><set name="SWF_VERSION" value="11.8" /></code>
</li>
<li>Disable gamepads on flash: <code><haxedef name="FLX_NO_GAMEPAD" if="flash"</code><br /><br /><br />
Hopefully I don't run into this problem because I will be converting my old as3 code base to haxe. <br />
<code> </code>
</li>
</ol>
</div>
</div>
</div>
<br />
<br />PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-69660404159281968412014-07-17T02:21:00.000-07:002014-07-17T02:21:58.102-07:00OpenFL is not a recognized internal or external command:<br /> Hmm... The lime thing worked for me. But didn't have as many sample projects as I was hoping for.<br />
Think my next step is to download HaxeFlixel and run those sample projects and get them running on different targets.<br />
<br />
<br />
Making blog posts of trouble shooting as I go on my journey to get Haxe and OpenFL<br />
rolling. :)<br /><br />http://www.openfl.org/archive/community/installing-openfl/openfl-not-recognized-internal-or-external-command/<br /><br />Instead of "openfl create DisplayingABitmap", try "lime create openfl.DisplayingABitmap", and so on. We'll try and get the documentation updated.<br />
http://www.openfl.org/archive/profile/1/ <<stalk this guy. <br />
<br />
<br />
<br />
<br />
I got this issue solved by running <strong>haxelib run openfl-tools setup</strong><br />
I dont remember if it is istalled by default (check by running <strong>haxelib list</strong>), if not - run <strong>haxelib install openfl-tools</strong><br /><br />PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-58236497506707896452014-07-17T01:38:00.002-07:002014-07-17T02:14:35.455-07:00Flash is dying, should I use unity?<br />
Flash is dying.<br />
Should I go to Unity?<br />
No!!!<br />
<br />
Adobe is killing flash, and look what happened with XNA.<br />
<br />
Sure, Unity will be good for 5 or 10 years. But I am in this for longer term that that.<br />
<br />
I don't want to be a slave to proprietary platforms, being forced to spend all my time<br />
converting code every time technology changes.<br />
<br />
I've been thinking about this for over six months.<br />
<br />
This resource is pretty good:<br />
http://haxe3.blogspot.com/2013/07/getting-started-with-haxe-3-and.html<br />
<br />
Also, a year ago I compiled some Haxe and it worked. I can't say that for every<br />
platform I have tried. Only reason I didn't go with it then was I wasn't sure it<br />
had been around long enough to be safe.<br />
<br />
Now I am sure it is.<br />
<br />
-MakeGamesHappen<br />
(-John Mark)<br />
<br />
Trouble shooting notes for:<br />
http://haxe3.blogspot.com/2013/07/getting-started-with-haxe-3-and.html<br />
<br />
Need to install the other packages with these commands:<br />
haxelib install openfl setup<br />haxelib run openfl setup<br />haxelib install openfl-compatibility<br />haxelib install openfl-html5<br />haxelib install openfl-native<br />haxelib install openfl-samples<br />haxelib install openfl-tools<br />haxelib list<br /><br />New problem:<br />Debugging and running flash target.<br />This file does not have a program associated with it for performing this action.<br />Please install a program or, if one is already installed, create an association<br />in the Default Programs control panel.<br /> PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-25042003568728555602014-04-03T14:58:00.003-07:002014-04-03T14:58:48.883-07:00Flash Develop: Could Not Open [...] lib\i386\jvm.cfg'<pre><br />I recently MANUALLY installed JAVA by cutting and pasting my java installations from my C:\DEV\JAVA folder of a machine I recently fried via emptying mountain dew into the keyboard.<br /><br />I have installed FlashDevelop and Java more times than I can count.<br />As usual, I ran into some trouble.<br />
<br />
<br />
<br />
<br />
<br />
<br />Before I tell you, it is important to note the layout of my files:<br />
With flash develop, you MUST use the 32 bit version of Java. <br />
C:\DEV\Programs\JAVA\JDK6_32BIT<br />
C:\DEV\Programs\JAVA\JRE6_32BIT<br />
<br />Here is what I did:<br />
<br />To get flash develop to know where java is, add this to your PATH variable:<br />C:\DEV\Programs\JAVA\JDK6_32BIT\bin\<br />Aka: Whatever bin folder contains BOTH "java.exe" and "javac.exe".<br />
<br />
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
TO GET RID OF "Could Not Open [...] lib\i386\jvm.cfg" ERROR:<br />YOU WILL NEED TO ADD THE JAVA_HOME VARIABLE:<br />JAVA_HOME == C:\DEV\Programs\JAVA\JRE6_32BIT<br />
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br /><br />Also: Tips on the internet say check system32 for copies of Java that were not deleted during a previous un-install.<br /><br />I recommend making a shortcut to environment variables if you are a developer.<br />You will be using them often. Especially when setting up new development environments.<br /><br />For my Windows 7, the shortcut should point to:<br />
%windir%\System32\rundll32.exe sysdm.cpl,EditEnvironmentVariables<br /></pre><br /><br />PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com1tag:blogger.com,1999:blog-2343132944910720069.post-52052794783434377962013-09-14T23:51:00.001-07:002013-09-14T23:51:53.263-07:00With is not the only way to shorthand in AS3<pre>
var arr:Array = new Array();
var p:Function = arr.push;
p("hello");
p("whats up?");
for each(var s:String in arr){trace(s);}
</pre>PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-77790339831998546932013-07-29T13:48:00.001-07:002013-07-29T13:48:57.624-07:00Intellesense Recognizes imports but FlashDevelop compiler does not
After about an hour of trouble shooting why my AS3 game project compiles on my old computer, but NOT on my new computer...
I finally figured it out.
The older version of FlashDevelop let me get away with this:
A file named:
FlxTileMapEXT.as
Inside the class:
[...]
public class FlxTilemapEXT extends FlxTilemap
[...]
When I imported and used the class:
import FlxTilemapEXT
Everything worked... But on my new computer it kept saying that the definition
"FlxTilemapEXT" could not be found.
See the problem?
Answer:
Case sensitivity.
My file name is FlxTileMapEXT, but it defines a class FlxTilemapEXT.
FlxTileMapEXT != FlxTilemapEXT
However, the old version of FlashDevelop let me get away with this.
SIDE NOTE RELATED TO HAXE:
NOTE: Haxe compiling in flash develop is even stricter.
Avoid underscores in your file names.
Also, avoid folders that start with CAPITOL letters, as it will short-circuit import statements.
The compiler will think the folder is a class.PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-50614442333556731222013-07-18T11:33:00.001-07:002013-07-18T11:33:11.397-07:00Hide Flixel Mouse and Show System Cursor
I combine my Flixel games with a UI layer on TOP of the Flixel Game Sprite.
Because of this, it is necessary to use the system cursor, so that the UI layer is not drawn on top of my cursor.
One way to do it:
myFlxGameInstance.useSystemCursor = true; //set to true to make sure FlxG does not undo your changes when you switch states.
FlxG.mouse.hide(); //Hide the Flixel mouse.
flash.ui.Mouse.show(); //Show the standard system cursor
Or:
You can specify to use the system cursor in the constructor of your FlxGame instance.
But if for some reason you want to change things later. The above is how you would do it.PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-69063483986406081632013-05-25T15:06:00.001-07:002013-07-28T09:53:12.541-07:00InfinityBomber76[ UPDATE: 2013.07.28: SWF FILE REMOVED. Have decided to keep game off internet until it is finished and copyrighted. ]
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimby3ckAbPCTm3Tdwk_0nBs0xRgJ8mbiTJPajj5VM-c6np7HVKU0iTxnsqWSpvwxGsMBwONakYj0ID4_cYbSiRfTLv9dHRQFNgdvBOD_IxNhuohVTbjPjoGAo1819Gjx7UYOi1UN5bnAg/s1600/F76.png" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimby3ckAbPCTm3Tdwk_0nBs0xRgJ8mbiTJPajj5VM-c6np7HVKU0iTxnsqWSpvwxGsMBwONakYj0ID4_cYbSiRfTLv9dHRQFNgdvBOD_IxNhuohVTbjPjoGAo1819Gjx7UYOi1UN5bnAg/s320/F76.png" /></a>PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-58266892715515155822013-05-14T19:37:00.001-07:002013-05-14T19:37:53.049-07:00Static Initializers In Haxehttp://haxe.org/doc/snip/initialization_of_statics
Unlike in AS3, it doesn't look like you can have unlabeled brackets in the beginning of a class to put static initialization code.
Here is a way to statically initialize something:
<pre>
public static var NUMBERS = {
var a = new List();
for (i in 0...10) a.add(i);
a; // result of last block expression is saved in NUMBERS
}
</pre>PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-11481529199600860722013-05-13T22:42:00.001-07:002013-05-13T22:42:12.135-07:00Function Types In Haxehttp://stackoverflow.com/questions/14025739/passing-a-function-as-a-parameter-in-haxe
<pre>
// fType : T -> Void
// argument means that it takes a function "fType"
// that takes one argument of type "T" and returns Void.
public function applyFuncToAll( fType : T -> Void ):Void
{
cur = first;
while (true)
{
//Call bound function on current object in list.
fType( cur.obj );
if (cur.hasNext)
{
cur = cur.next;
}
else
{
break;
}
}
}
</pre>PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-15985350350171628402013-05-05T17:01:00.002-07:002013-05-05T17:01:07.211-07:00CS5 crashes on startup or new file creationLooks like the solution to getting my CS5 programs working again is the removal of bad network printers.PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-67329233333703869792013-05-04T13:43:00.000-07:002013-05-04T13:43:25.555-07:00Packages and Imports in Haxe
<pre>
Unlike in Actionscript, it looks like you must conform to the "Constant-Class" rule when naming packages.
--Notes------------------
The class path:
import com.JMIM.TestClass;
Gave me an error "Unexpected com" or something like that.
I thought it might be namespace collision since the NME library also has a com folder so I tried:
import dotCom.JMIM.TestClass;
And changed the folder structure accordingly only to end up with the same error.
During this whole time I did make sure to add my personal library by putting another source path tag into the .nmml file.
Then I started getting errors something along the lines: "Unexpected class JMIM" or something.
I changed it to:
import dotCom.jmim.TestClass;
Getting closer to a compile. :)
Also, it looks like restarting my computer after messing extensively with the package structure MIGHT
be the way to go once you've done everything you can think of.
--------------------------
</pre>
PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-38663388822092683922013-05-02T16:15:00.001-07:002013-05-02T16:15:18.762-07:00AppTopia
Market Plan:
1. Make source code.
2. Re-skin game over and over till it stops making money.
3. MAYBE sell source code on internet.
Make at least 3 skins of each game.
Do NOT take advantage of artists.
Offer artists a FLAT commission rate and 50% of whatever the profit is from the game.
Pitch to artists:
1. Guaranteed Cash. Half now, half when you finish.
2. 50% on whatever the game makes.
3. There WILL be a credits section. You may use it as a portfolio piece.
This could help you with a full time job, or just to brush up on your skills.
PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-34036628807258469362013-05-01T20:50:00.002-07:002013-05-01T20:51:30.990-07:00How to add library in Haxe / NME / NMMLAdding library in Flash Develop Haxe: <br />
<!-- Paths to libraries. Must be declared here. Not in the project properties. --> <br />
<source path="Source" /> <br />
<source path="C:\Users\JMIM\Desktop\HAXELIB" /> <br />PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-75944665881621076732013-04-28T21:27:00.003-07:002013-04-28T21:58:22.536-07:00Haxe Flixel Links
Links for my research:
Tutorial:
http://dustytome.net/moot/2012/08/haxe-flixel-platformer-tutorial/
Get HaxeFlixel source code:
https://github.com/Beeblerox/HaxeFlixel
TODO:
Get
$Haxlib install HaxeFlixel
Working on .cmd
Haxlib Setup:
http://haxe.org/com/haxelib/setup
Problem with Haxe Flixel:
C:\Motion-Twin\haxe\lib\HaxeFlixel/0,9,0a/org/flixel/FlxText.hx:24: characters 17-52 : You cannot override properties
PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-54497167294122463412013-03-20T04:12:00.004-07:002013-03-20T04:13:31.015-07:00added to my list of people to stalkIK Solver in AS3: </br>
http://vimeo.com/23191399 </br>
http://www-scf.usc.edu/~shopkins/contact.html </br>
</br>
also</br>
http://www.adobe.com/devnet/flash/articles/spring_tool.html</br>PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-88432209570183022092013-03-20T03:03:00.003-07:002013-03-20T03:13:21.299-07:00Trig rounding errors in AS3Maybe I just don't know my trig... </br>
But if I do... </br>
The difference between 1.888 and 1.253 is a HUGE rounding error. </br>
var m:Number = Math.asin( Math.sin(1.888) ); </br>
//m = 1.253 </br>
http://answers.yahoo.com/question/index?qid=20080227172624AAwIQZA </br>PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-24711889218443354702013-03-14T01:41:00.001-07:002013-03-14T03:15:00.075-07:00Iterate through quadrantsThis is ridiculous:
<pre>
var xo:int; //x offset.
var yo:int; //y offset.
var i2:int;
var z0:int;
var z1:int;
var zeroMaybe:int;
for (var i:int = 0; i < 4; i++)
{
zeroMaybe = (i < 2) ? 0 : 1;
i2 = i + 1;
z0 = (i & 1);
z1 = (i2 & 1);
xo = (z0 + (-1 * z1)) * zeroMaybe;
yo = (z1 + ( -1 * z0)) * (1-zeroMaybe);
trace("debug");
}
</pre>
Guess I should just put the pairs into a vector.
Trying to iterate over checking 4 positions relative to a tile:
UP,DOWN,LEFT,RIGHT.
By outputting the correct offset values each iteration:
[0,1] [0,-1], [1,0], [-1,0] in no specific order.
Actually... This isn't bad for building a lookup table that is a linked-list.
Same thing said another way:
<pre>
for (var i:uint = 0; i < 4; i++)
{
var and3:uint = i & 3; //OUTPUT: 0,1,2,3 0,1,2,3
//OUTPUT in BINARY: 00, 01, 10, 11
//If we SUBTRACT the bits, we can get 0,-1,1,0. Just what we need.
var a3 :uint = (i + 2) & 3; //same as and3, but input is shifted over two.
//When and3 and a3 are converted to -1,1,or zero, we will have the following outputs in this order:
// [0,1] , [-1,0], [1,0], [0,-1] ALL THE KITTY KORNERS.
var npX:int = ((and3 & 2)>>1) - (and3 & 1); //convert number 0-3 to: 0,1,-1
var npY:int = ((a3 & 2)>>1) - (a3 & 1); //convert number 0-3 to: 0,1,-1
//Building linked-list table of offset quadrant values:
cur.x = npX;
cur.y = npY;
if (i != 3)
{
cur.hasNext = true;
cur.next = new LinkedXYPair();
cur = cur.next;
}
trace("debug: [" + npX + " : " + npY + "]");
}
</pre>PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-75955480090514266012013-03-10T13:27:00.002-07:002013-07-28T09:54:04.626-07:00Shiny Little Plasma Flares[ UPDATE: 2013.07.28: SWF FILE REMOVED. Have decided to keep game off internet until it is finished and copyrighted. ]
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzIB07-2vqtbwHRpyuvY8lqW00dmlYuq5Wwdnv-rRxP3K6P5KdOzEbZ68bk745Cj_YOnsK-mCIP2FWGUslULu-osOxrqVHdIhqgJi0SnhHnrv8Ei40LikwAvz6Zzl4aiRELAuhwYd-nsI/s1600/F75_Large.PNG" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzIB07-2vqtbwHRpyuvY8lqW00dmlYuq5Wwdnv-rRxP3K6P5KdOzEbZ68bk745Cj_YOnsK-mCIP2FWGUslULu-osOxrqVHdIhqgJi0SnhHnrv8Ei40LikwAvz6Zzl4aiRELAuhwYd-nsI/s320/F75_Large.PNG" /></a>PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-13663592962227511212013-03-06T18:36:00.000-08:002013-03-06T18:41:10.393-08:00When is SetPixel32 Faster than CopyPixels?<pre>
package
{
//Common knowledge is SetPixel32 is slower that CopyPixels.
//What I want to know however is... What is the equivalency ratio?
//Meaning:
//Does using setPixel32 100 times take the same amount of time as CopyPixels for a (100x100) (10,000 pixel area)? Or something like that?
//If you are going to use particles that use the "setPixel32" command... We need to know.
//Compare setting pixel32 to usingCopyPixels on ONE pixel and see the speed difference.
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.utils.Timer;
import flash.utils.getTimer;
/**
* ...
* @author JMIM
*/
public class Main extends Sprite
{
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
for (var i:int = 1; i < 100; i++)
{
pixelTest(i);
}
}
public function pixelTest(inRecSize:int):void
{
trace("rec size == " + inRecSize + "--------::");
var t1:Number;
var t2:Number;
var tt:Number;
var counter:int;
var counterMax:int = 98765;
var theBm:BitmapData = new BitmapData(500, 500, true, 0x00);
var copyFromBm:BitmapData = new BitmapData(500, 500, true, 0x00);
var ZZ:Point = new Point(0, 0);
var rec1x1:Rectangle = new Rectangle(0, 0, inRecSize, inRecSize);
var setPixelCount:int = 0;
var setPixelTimes:int = (inRecSize * inRecSize);
t1 = getTimer();
counter = 0;
do
{
counter++;
if (counter > counterMax) { break; }
setPixelCount = 0;
do {
setPixelCount++;
if (setPixelCount > setPixelTimes) { break;}
theBm.setPixel32(10, 10, 0x88FF);
}while (true);
}while (true);
t2 = getTimer();
tt = t2 - t1;
trace("setPixel32 time:: tt==" + tt);
t1 = getTimer();
counter = 0;
do
{
counter++;
if (counter > counterMax) { break;}
theBm.copyPixels(copyFromBm, rec1x1, ZZ, null, null, true);
}while (true);
t2 = getTimer();
tt = t2 - t1;
trace("copyPixels time:: tt==" + tt);
}
}//class
}//package
</pre>
<pre>
//OUTPUT:
rec size == 1--------::
setPixel32 time:: tt==50
copyPixels time:: tt==160
rec size == 2--------::
setPixel32 time:: tt==130
copyPixels time:: tt==160
rec size == 3--------::
setPixel32 time:: tt==270
copyPixels time:: tt==170
rec size == 4--------::
setPixel32 time:: tt==470
copyPixels time:: tt==170
rec size == 5--------::
setPixel32 time:: tt==680
copyPixels time:: tt==170
rec size == 6--------::
setPixel32 time:: tt==980
copyPixels time:: tt==180
rec size == 7--------::
setPixel32 time:: tt==1320
copyPixels time:: tt==170
rec size == 8--------::
setPixel32 time:: tt==1730
copyPixels time:: tt==180
rec size == 9--------::
setPixel32 time:: tt==2150
copyPixels time:: tt==190
rec size == 10--------::
setPixel32 time:: tt==2690
copyPixels time:: tt==190
rec size == 11--------::
setPixel32 time:: tt==3220
copyPixels time:: tt==190
rec size == 12--------::
....
//Personally interested in this one, because my tilemap uses 16x16 tiles:
rec size == 16--------::
setPixel32 time:: tt==6830
copyPixels time:: tt==210
</pre>PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-50240446165474357612013-03-06T02:24:00.003-08:002013-03-06T02:29:00.604-08:00Particle Bit Packing Math ExperimentWas wondering if I could make a more efficient particle system by packing the position, velocity, and acceleration values of the particle into a SINGLE signed integer.
The thought was that access would be faster since it is all in the same variable.
So far... I don't see any support for this in my research. Here is my math stuff.
Note: was also packing color information.
A bit more looking, looks like you may be able to get a marginal speed increase.
But so marginal that, you would have to pack and unpack in a flawless manner to get that speed increase.
And the obfuscation would make the system too hard to work with and edit.
<pre>
//Packs position, velocity, acceleration, and color into a SIGNED(+-) integer.
public function putPVAC(p2047:int, v127:int, a7:int, c3A:int, c3R:int, c3G:int, c3B:int):int
{
//SIZES: HEX BITS UINT INT BIN
//pos: FFF 12 4095 +-2047 1111 1111 1111
//vel: FF 8 255 +-127 1111 1111
//acc: F 4 15 +-7 1111
//clr: FF 8 255 N/A 1111 1111
// aa: 3 2 3 3 11
// rr: 3 2 3 3 11
// gg: 3 2 3 3 11
// bb: 3 2 3 3 11
//pack in position:
var packed:int = p2047;
packed = packed << 8; //shifting to make room for VELOCITY.
//pack in velocity.
if (v127 < 0) { v127 = 127 + (0 - v127);} //handle negative numbers.
packed = (packed | (v127 & 0xFF)) << 4; //shifting to make room for ACCELERATION.
//pack in acceleration:
if (a7 < 0) { a7 = 7 + (0 - a7); } //handle negative numbers.
packed = (packed | (a7 & 0xF)) << 2; //shift to make room for first color component.
// 42 127 212
//0 ----- 85 ----- 170 ----- 255
//pack in ARGB:
if (c3A > 212) { packed = (packed | (0x3)); } else
if (c3A > 127) { packed = (packed | (0x2)); } else
if (c3A > 42 ) { packed = (packed | (0x1)); };
//other wise it is zero and nothing needs to be set.
packed = (packed << 2); //shift to make room for SECOND color component.
// 42 127 212
//0 ----- 85 ----- 170 ----- 255
//pack in ARGB:
if (c3R > 212) { packed = (packed | (0x3)); } else
if (c3R > 127) { packed = (packed | (0x2)); } else
if (c3R > 42 ) { packed = (packed | (0x1)); };
//other wise it is zero and nothing needs to be set.
packed = (packed << 2); //shift to make room for THIRD color component. (G)
// 42 127 212
//0 ----- 85 ----- 170 ----- 255
//pack in ARGB:
if (c3G > 212) { packed = (packed | (0x3)); } else
if (c3G > 127) { packed = (packed | (0x2)); } else
if (c3G > 42 ) { packed = (packed | (0x1)); };
//other wise it is zero and nothing needs to be set.
packed = (packed << 2); //shift to make room for FOURTH color component. (B)
// 42 127 212
//0 ----- 85 ----- 170 ----- 255
//pack in ARGB:
if (c3B > 212) { packed = (packed | (0x3)); } else
if (c3B > 127) { packed = (packed | (0x2)); } else
if (c3B > 42 ) { packed = (packed | (0x1)); };
//other wise it is zero and nothing needs to be set.
return packed;
}
public function getPVAC(com:int):void
{
var acc:int;
var vel:int;
var pos:int;
var clr:int;
var color:uint;
// AA RR GG BB
// 11 11 11 11
//extract color: // 0xC0 | 0x30 | 0xC | 0x3
clr = com & 0xFF; //ARGB color channels.
color = ( ((clr & 0xC0)>>6) * 85) << 24 |
( ((clr & 0x30)>>4) * 85) << 16 |
( ((clr & 0xC )>>2) * 85) << 8 |
( ((clr & 0x3 )>>0) * 85) << 0;
//extract acceleration.
com = com >> 8;
acc = com & 0xF;
if (acc > 7) { acc = 7 - acc; }
//extract velocity.
com = com >> 4; // ==com >> 12 when looking at cumulatively.
vel = com & 0xFF;
if (vel > 127) { vel = 127 - vel; }
//extract position:
//This is only ONE line because the signed bit on the com integer affects this.
pos = com >> 8; // ==com >> 20 when looking at cumulatively.
trace("color==" + color);
trace("pos ==" + pos);
trace("vel ==" + vel);
trace("acc ==" + acc);
//make sure color is what you think it is:
var rgb:RGB = RGB.make(color);
trace("a ==" + rgb.Alpha);
trace("r ==" + rgb.Red);
trace("g ==" + rgb.Green);
trace("b ==" + rgb.Blue);
}//getPVAC
</pre>PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-33880637426739151632013-03-05T22:53:00.003-08:002013-03-06T02:17:04.320-08:00int(2147483648)int(2147483648) marginally faster than int.minValue in AS3
<pre>
t1 = getTimer();
counter = 0;
do
{
counter++;
if (counter > counterMax) { break;}
someValue = int(2147483648);
}while (true);
t2 = getTimer();
tt = t2 - t1;
trace("tt==" + tt);
t1 = getTimer();
counter = 0;
do
{
counter++;
if (counter > counterMax) { break;}
someValue = int.MIN_VALUE;
}while (true);
t2 = getTimer();
tt = t2 - t1;
trace("tt==" + tt);
</pre>PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0tag:blogger.com,1999:blog-2343132944910720069.post-74626726848440543002013-03-01T18:54:00.002-08:002013-03-01T18:54:27.891-08:00Multiple Bomb Types and Crates now in<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" height="480" width="640"> <param name="movie"
value="http://www.deviantart.com/download/357174992/f74_by_jmim-d5wnhzk.swf"><param name="quality" value="high"><param name="wmode" value="opaque"><embed src="http://www.deviantart.com/download/357174992/f74_by_jmim-d5wnhzk.swf"
quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash"
width="640px" height="480px" wmode="opaque"> </embed> </object>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxs2behuN2erddiy424er7_oYzMWY_AIaDM2NVWZeSZfGN40DNLdTCotZaUaDNcZO87y7nF9Waik4-cITaiPch7q-1uZbVGmI9EvASn0djnBNpdCH5cZdMvd2WzfpmmYixvvW-uPheOA8/s1600/F74.png" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxs2behuN2erddiy424er7_oYzMWY_AIaDM2NVWZeSZfGN40DNLdTCotZaUaDNcZO87y7nF9Waik4-cITaiPch7q-1uZbVGmI9EvASn0djnBNpdCH5cZdMvd2WzfpmmYixvvW-uPheOA8/s320/F74.png" /></a>PolygonRunnerhttp://www.blogger.com/profile/15934787628195946782noreply@blogger.com0