Actionscript 3 :: Fastest Way To Calculate Fog Of War?

Jan 14, 2011

I have the following function in my FogOfWar class, it calculates if its team can see the position that is passed on the arguments:[code]My problem is that, with only 3 characters in the game, it can only run 4000 times per second, which is not too much.I can implement a cache, so it caches the most commons positions, but, what else can I do to optimize it?

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Calculate Age From XML Data; Calculate Dates

Jul 1, 2011

I as this working in AS2 and need to update to AS3...shows that AS3 doesn't like sloppy coding. Here's what I need: I pull data from an XML and that works when I put the data into a dynamic text box. However, I can't seem to get the date of birth into a variable. I have some code that calcs age in years but uses a string literal that I thought I could just replace with a variable from my XML...ain't a workin'. Here's the code I have:

ActionScript Code:
import flash.display.*;
import flash.text.*;
import flash.events.*;

[Code]......

View 0 Replies

Flash :: Fastest Way To Get Power By 2

May 24, 2011

The question is simple; I need the fastest way to calculate power 2. I need that for this formula which calculates distance between 2 points.var Dist:int = Math.sqrt( (mmx - ox) * (mmx - ox) + (mmy - oy) * (mmy - oy) );

View 2 Replies

ActionScript 3.0 :: Fastest Way To Get RGBA?

Jul 14, 2009

What is the fastest and most efficient way to get RGBA from an image you don't want to display?

I don't care if it uses air or is backwards compatible with a previous version of the player.

Should I be using file io and reading in the bytes and writing my own parser?

Maybe loadBitmap and getPixel?

Are there certain tricks and optimizations to prevent excess work on the player's side?

View 3 Replies

ActionScript 3.0 :: AIR - What Is The Fastest Way To Load A .png

Sep 19, 2009

I'm trying to figure out the fastest possible way to load a .png image into a BitmapData object. I am performing multiple processes that do this (load a .png from filesystem). The progress is shown using a loading bar, and I would like to speed up the loading time. Now this process can be called over n number times (via a timer). Right now the method I am using to this is:

[Code]...

View 4 Replies

Javascript :: Fastest Way To Do A Collection Subtraction?

Mar 8, 2010

I have two Sets. Set b is the subset of Set a. they're both very huge Sets. I want to subtract b from a , what's the best practice to do this common operation? I've written to many codes like this , and I don't think it's efficient.

[Code]...

View 7 Replies

Flash - Fastest Way To Get Negative Numbers?

Jun 10, 2011

Is there any Fastest way for this line?
ballAngelRadianVector = -ballAngelRadianVector;
And also this:
ballDegree = fee - ballDegree ;

View 1 Replies

Actionscript 3.0 :: Fastest Way To Load External .png?

Sep 14, 2009

I have searched google for an answer to my problem, but to no results have helped me to solve it. I am trying to find the fastest possible way to load an external .png (as the title suggests). The reason for this is because I want to speed up the loading time of my Adobe Air Application. It loads in a various number of .png files (with transparency) and displays them in a tilelist via Bitmap.

[Code]...

View 4 Replies

Performance :: Find Distance Between 2 Points In Fastest Way

Sep 22, 2011

This code calculates the distance between 2 points by using distance formula, Math.sqrt ( (x1 - x2)^2 + (y1 - y2) ^2). My first point has mmx and mmy coordination and second one has ox and oy coordination. My question is simple, is there any FASTER way for calculate this?

[Code]...

View 3 Replies

ActionScript 3.0 :: Fastest Imagetype For Animated Transparant Movieclip?

Dec 10, 2011

Im using a lot of movieclips in an app.Its hitting the performance limits.Im using .png files in animated movieclips.Looking in the clip it says bitmap as type.. source...pngI used .png because i want the alpha background possibility.I then went into some of the movieclips and changed properties convert to bitmap (althoug technicly they already were according to flash)After this i feel the performance has slightly improved.Is this true or just in my mind & wishfull thinking.

View 3 Replies

Actionscript 3 :: Fastest Method To Find A Complex Type In A List

Apr 12, 2011

I need to know the best method to find an item inside a list (Vector, Array, Dictionary, whatever is faster) of complex type (extensions of Objects and Sprites). I've used "Needle in Haystack" method, but it seems that it isn't fast enough.

E.g. Suppose that I have a collection of Sprites (a pool, in fact). Each sprite will be added to the stage and perform some action. After that, it will die. I don't want to pay the cost to dispose it (garbage collect) and create another (new) one every time so I'll keep the dead sprites in a collection.

Sometimes times I'll call a method that will add a sprite to the stage. This sprite can be a old one, if it is already dead, or a new one, if the pool don't have any free sprite.

One of the scenarios that pushed me to this question was a Particle System. A "head" particle leaving a "trail" of particles every frame and exploding into a flashy multitude of particles... Every frame...

Some times this counts up to 50.000 PNGs with motion, rotation, alpha, event dispatching, scale, etc... But, this is JUST ONE scenario...

At the moment I'm trying to use a Object Pool with a Linked List... Hopes that it will be faster that running a whole Array/Vector or create new instances every frame an let them dye with Garbage Collection.

View 6 Replies

As3 :: Flash - Fastest Method To Search Next Higher/lower Value In Unsorted Array?

Mar 15, 2011

how to deal with unsorted arrays to get the next higher or next smaller value?

var _myArray:Array = (1,pizza,2,6,8,test,11,16,17,cola)
_myArray.splice(4,1) // > remove number 8 !
trace(_myArray) // > array contains now: (1,pizza,2,6,test,11,16,17,cola)

how can i get the next higher value (= 11) ?

View 2 Replies

ActionScript 3.0 :: Fastest Method Of Determining If A Triangle Is Encompassed By Smaller Grid Squares?

Jul 19, 2010

I've got my 3D sphere to triangle collision detection working now, but I need an efficient method of adding the triangles to the broadphase grid.

This is easy enough if the triangles are smaller than the grid nodes, however - especially given the polycounts I'm working with - it's going to be fairly frequent that a triangle is significantly larger than the grid nodes.

Here's an example.See the yellow polygon? Just adding it the grid nodes by it's vertices results in it NOT being added to 4 grid nodes that it does reside in.

My first thought is repeatedly casting rays along one of the edges from the normal of the edge until you find the intersection point with one of the other edges, of course checking for intersections with the grid edges until you reach the destination intersection with one of the other edges of the triangle. This would work, but is not particularly fast.

Although these triangles aren't being added/removed in real time, only when building the level, when constructing a level with say 100,000 polygons total, I obviously want it to be processed as quickly as possible.

View 14 Replies

Arrays :: Fastest Way To Merge Multiple Arrays?

Sep 26, 2011

I'm trying to write a function where I can specify any amount of array, and the return value will be an array containing the contents of all of the specified arrays.I've done this, but it seems like a really slow and ugly way of doing it:

var ar1:Array = [1,2,3,4,5,6,7,8,9];
var ar2:Array = ['a','b','c','d','e','f','g','h'];
function merge(...multi):Array[code].....

Is there an inbuilt and more efficient / nice way of achieving this? The result does not need to be in the same order as the input - completely unsorted is fine.

View 3 Replies

Calculate Adler32 Checksum For Zip?

Aug 22, 2009

I'm using a combination of Paul Duncans php ZipStream [url]...

Works fine in Air, but when running Flex in browser, the zip needs to include a Adler32 checksum in the header for FZip to be read.

How can I calculate an Adler32 checksum for the zip in php?[code]...

View 3 Replies

Flex :: How To Calculate The Xmldata

Aug 18, 2010

i'm getting the xmldata from the httpservice (using cgi) and i have not set resultformat(it is coming as an object only),the xml data in this format

[Code]...

when i was tried to count the employee tag,i getting the problem, my code will like this:

[Code]...

View 1 Replies

ActionScript 3.0 :: Calculate The Value Of A Formula?

Oct 21, 2009

I need to calculate the value of a formula which is passed dynamically by using text box.This formula contains a set of variables which are already declared and assigned a value(hard coded). I will provide a submit button , on clicking this button I must be able to evaluate the formula that I have passed dynamically using the text box.

View 2 Replies

ActionScript 3.0 :: Calculate Total With XML?

Apr 28, 2011

I have problems with calculating values of a childnode.

My XML structure

<FILE>
<NUMBER TYPE="test"> 1 </NUMBER>
<NUMBER TYPE="test"> 2 </NUMBER>
</FILE>

[Code].....

the trace outputs: 2 (last row)

and not 3 as i expected. De Element++ is not working.

View 2 Replies

ActionScript 2.0 :: Calculate An Intercept Course?

Nov 30, 2006

I'm working on a game which will involve space battles, and automated turrets. The turrets are giving me the headache right now. Here's what I got so far.

[URL]

The problem is, that the turrets aim at the center of their target, instead of aiming in front of their target to compensate for their movement. I can't seem to crack the equations needed to get the right rotation, for the turret to fire from. The data the turret has avaible, or that I could easily make avaible to it, are:

- The distance to the target (and it's x and y components)
- The current speed vector (the size and rotation)
- The angle between the heading of the target and the turret's location
- The speed of the turret's shot (fixed speed)

View 2 Replies

ActionScript 2.0 :: How To Calculate Cos/sin/tan Manually

Aug 30, 2003

write down the formulas that flash MX uses when you use the functions tan/sin/cos...I am trying to get a good grasp on these things and it

View 12 Replies

ActionScript 3.0 :: Calculate Inner Rectangle?

May 20, 2010

how to find the biggest possible area within a rotated image (the black rect in attached image), but can't figure out how to calculate the points TL, TR, BR, BL to draw my rectangle (the red rectangle in attached image).

View 3 Replies

ActionScript 2.0 :: CS3 Calculate Date Difference?

Nov 9, 2009

I am trying to create a 30 day trial period limitation in Flash CS3. I am having a problem with checking the number of days. I am using zinc mdm to get the date of an external file. Following is the code I am using.

var d1:Date = new Date(mdm.FileSystem.getFileDate("c:\myText.txt")) ;
var d2:Date = new Date();
//(Date2 - Date1)/

[Code].....

View 8 Replies

ActionScript 3.0 :: Calculate 3D Plane From 2D Projection

Jan 16, 2012

I'm basically trying to emulate Photoshop's Vanishing Point tool where you can define the 4 2D points and the 3D plane is calculated from that information, in terms of the rotation of the plane relative to x y and z axes.

So if you have an image like this one:
And you define the points of the four corners, maybe like this:

It would define the 3D plane that the surface must live on relative to the x y and z axes. Researching this has led me to some tutorials on drawTriangles and Homographies, but they all seem to be focused on mapping bitmap data and I can't seem to find anything that defines a 3D plane itself.

View 5 Replies

ActionScript 3.0 :: Way To Calculate Time Diffrence?

Jul 8, 2009

I am trying to figure out a way to calculate time diffrence betweennow and a set timevar

settime:Number = 2:35am
and
now would be getDate();

[code].....

View 8 Replies

ActionScript 3.0 :: How To Calculate Childlist In XMLdata

Mar 17, 2010

I have lot of child inside my xml data.I want to calculate total my child list

View 2 Replies

ActionScript 3.0 :: Calculate The Sum Of Numbers In An Array?

Apr 27, 2010

So my array contains marks for a ficticious class and i need to be able to calculate these marks to give me a class average which is this formula; all marks added / number of marksIs there a way to do this within an array?

My code for the program so far is:
// Create Arrayvar marks:Array =["100","76","80","54","23"];// Button Functionenter_btn.addEventListener(MouseEvent.CLICK, onClick); function

[code].......

View 3 Replies

ActionScript 3.0 :: Calculate All Points On A Curve?

Mar 20, 2011

I try to calculate all the points on a curve.

The curve decided by the width(X on the picture) and height(Y on the picture) properties of a movieclip.The distance between each green point on curve is the same.

View 24 Replies

ActionScript 3.0 :: Ability To Calculate Number Of Mcs On Another Mc?

Dec 20, 2011

So i got the ability to add a numeric value to an mc down. So every time i pick up a coin with a value attached to it, and place it on a hand mc, it'll trace the value i've assigned. very excited on this aspect. I've been searching around for the ability to have a master value that I set say for example 5.0. When I hit another mc, this function (that i need to find out about) would check the values that are resting on the hand. I could not find the proper syntax. I have a very good idea of where it would go and what it would look like but I'm missing the forumla. Now I've bold/underlined the area that I think the check would be executed. When you hit the checkout button, it would tally the myValue sums that are currently resting on the hand mc. So my thought train is that I'd declare another variable like masterTotal (the value I want the person to match), and the handTotal (what is resting on the hand).

import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;

[code].....

View 6 Replies

ActionScript 3.0 :: Calculate Based Upon An Mc Touching An Mc?

Dec 20, 2011

I have a running total. When an mc hits the table or hand it'll adjust the total. The problem is I only want the total to reflect when an object is resting on the hand mc. If i remove something from it, remove its value from the total. Now to be smart I have it add when an mc hits the hand, and remove a value if an mc hits the table. The problem, if I never touch the hand and keep dropping the mcs on the table, i get a negative value. Is there a way to calculate a total only when a mc rests on the hand mc

View 8 Replies

Actionscript 3 :: Calculate Shades Of A Given Hex Color?

Feb 13, 2010

I need a way to calculate lighter hex color(s) based on a provided one. I realize I could use a color transform, but I need the actual value in order to generate a gradient.

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved