Archive for April, 2007

Monday, April 30th, 2007

Polygonal Labs has an excellent random number generator.  There is an AS2 and AS3 version and it has much better random numbers tools such as seeds and ranges.

When developing games you often need a PRNG that, once initialized with a seed value, produces always the same sequence of random numbers after it. The Math.rand() function in Flash is a PRNG, but it doesn’t let you define a seed value (I think it’s picked randomly when the swf starts, but there isn’t much information about it) so another solution has to be found.

One of the best PRNGs is the Mersenne Twister algorithm, but in my opinion it’s total overkill for flash games (also slow and difficult to implement). However, after spending some time with google I found an interesting site explaining the implementation of the Park-Miller-Carta PRNG, which belongs to the group of Linear congruential generators (LCGs).

read more >>

Download & Usage

Park-Miller-Carta Pseudo-Random Number Generator:
AS2 Version
AS3 Version

First define a seed value (default is one) and then call nextInt() to get the next integer value, nextDouble() to get a floating point number between 0..1 and nextIntRange() or nextDoubleRange() to generate numbers within a certain range.

Sunday, April 29th, 2007

Here’s some algorithms and techniques that most game developers should be aware of when developing games for Flash, Director or other gaming tools (primarily 2d or fake 3d).

A* (A Star)
http://en.wikipedia.org/wiki/A*_search_algorithm

Mode 7
http://en.wikipedia.org/wiki/Mode_7

Collision Detection
http://en.wikipedia.org/wiki/Collision_detection

Painter’s Algorithm (papervision/software blitter)
http://en.wikipedia.org/wiki/Painter’s_algorithm

Sprites
http://en.wikipedia.org/wiki/Sprite_(computer_graphics)

Isometric Projection aka Axonometric Projection aka Orthographic Projection (essentially lack of true perspective in 3d objects)

http://en.wikipedia.org/wiki/Orthographic_projection
http://en.wikipedia.org/wiki/Axonometric_projection
http://en.wikipedia.org/wiki/Isometric_projection

Well versed in mathematics such as Trigonometry and Calculus

http://en.wikipedia.org/wiki/Cosine
http://en.wikipedia.org/wiki/Sine
http://en.wikipedia.org/wiki/Tangent
http://en.wikipedia.org/wiki/Radian
http://en.wikipedia.org/wiki/Pythagorean_theorem
http://en.wikipedia.org/wiki/Linear_equation
http://en.wikipedia.org/wiki/Quadratic_equation
etc…

If you want to make games, math is required. Wiki should only be a starting point. Sometimes the best way to understand something is to implemented it or try to implement it yourself. There are lots of samples and tutorials on the web regarding these but its always good to understand what makes it all work, usually that is math. Right after “42″ it is the answer to Life the Universe and Everything.

We will feature another set for primarily 3d games such as quaternions, matrix maps, transformation matrices , 3d projection and more! Over time we hope to have a tutorial for all 2d in flash and 3d techniques in papervision or 3d framework such as OpenGL or DirectX.

Saturday, April 28th, 2007

Telerik has created a set of Silverlight controls.  They are always on top of new technology from Microsoft and sometimes it seems like they work there.  Here is a sample room editor that has must a sprinkle of pseudo 3d. One interesting thing about Silverlight is that MS AJAX will be specifically written to work with it.  I am sure there will be other packages but it appears like Microsoft is setting out the developer workflow quickly.
Photo Sharing and Video Hosting at Photobucket  Photo Sharing and Video Hosting at Photobucket

At this point Silverlight doesn’t compare much to Flash and has a long way to go.  The WPF libraries are excellent though and will get lots of following.  The Microsoft developer community is a bit like the Apple consumer in that they pretty much buy into anything that they are fed, so it will have some legs.

Silverlight, the cross platform version of WPF, is great (more on this later after I have delved in further) but it is no Flash.  However, it is eons ahead of their last attempt in Liquid Motion.

On Coding Silverlight vs. Flash9/AS3

I like using C#/XAML to code in Silverlight/WPF over Actionscript3 but AS3 is quite a nice language and it is starting to conform to the Javascript2 spec. I think that Javascript2 might be an underrated candidate for the NBL.   AS3 is also very similar to Java and its clone C# so really good solution developers should be learning and becoming experts at all three.

Saturday, April 28th, 2007

Zeh has posted a great article on using Tweener to animate along a Bezier.  There is even a papervision3d sample.  Tweener has been a good choice for papervision3d animation due to its flexibility to be able to easily handle z and custom params.Photo Sharing and Video Hosting at Photobucket

This is excellent for game development or pathing in game systems.  The sample in papervision is a set of cones that the path can be set around.  For custom scripted sequences and triggered events this is exactly what is needed. Things like flying through cities, vehicles, transitions, recording replays etc.

I am blown away by this as its probably the most useful and cool demo I have seen yet. Check it out Download the source here (Flash CS3, AS3). 

I will give this project 6-8months before its a full blown papervision3D scene editor in flash. 

Saturday, April 28th, 2007

Photo Sharing and Video Hosting at PhotobucketThe new Flash CS3 application is excellent.  The new menu and pallette system they have build in is very quick and non-intrusive.  The general UI is very responsive in Flash and Dreamweaver.  In version 8 and other big IDEs out there things have been slowing down, but this release by Adobe things have really sped up.  However if you have been developing Papervision3D and using flash 9 alpha, FlashDevelop etc you may have a bit of setup to do to use Papervision3D or some of your old kits that are having trouble compiling.

Compiling AS3 with Flash CS3 is pretty simple the default classpath to the ‘flash’ namespace is already set by the application to $(AppConfig)/ActionScript 3.0/Classes.  You can also add your class library path to where papervision3d is located in Edit > Preferences > Actionscript > ActionScript 3.0 Settings… (button). I keep mine in [drive]\Projects\FLASH\classpath\as3\. 

FlashDevelop/Flash9 Alpha AS3 Users

One problem is that if you have been using the alpha flash 9 and used FlashDevelop or another IDE you might have some classes to remove from your class path before you can jump right in with Flash CS3.  These would be anything in the ‘flash’ folder in your classpath and probably some type classes in the root such as Object.as (intrinsic classes you may have added to complile to AS3 or code completion like in FlashDevelop).

Best Solution

The best solution if you do not want to clean that manually is setup a new classpath folder and then move new AS3 libraries in there. Or, you could setup a new folder and keep the existing classpath until your projects are swtiched over. I keep a classpath for all versions I currently support in my development.

[drive]\Projects\FLASH\classpath\as3\

[drive]\Projects\FLASH\classpath\as3_alpha\

[drive]\Projects\FLASH\classpath\as2\

These paths can be added to your Flash IDE, your external flash actionscript IDE like FlashDevelop or other compilers that may come along now that Flex SDK is opensource.

Thursday, April 26th, 2007

Photo Sharing and Video Hosting at Photobucketflowlabs has a PSD to XAML converter. 

Psd2Xaml (with a splash of swf)

Simple, free, open-source tool for converting Photoshop .PSD files to XAML. Also supports limited SWF conversion to XAML.
This project is a by-product of the development of PaintLab, a node-based paint application.
Read more about the underlying PSD parser in this article: http://www.codeproject.com/cs/media/PSDParser.asp

Usage

Drag’n'drop PSD or SWF files to the application, and it will create XAML files in the same directory but with the extension xaml instead of psd. The individual layers’ bitmaps are saved in a subdirectory with the same name as the output .xaml file plus “_Bitmaps”.

Example: “Test.psd” is converted to”Test.xaml” and a new folder with the name “Test.xaml_Bitmaps” will be created, containing the bitmaps.

[source]

Downloads

Application: Psd2Xaml.zip (233 kb)
Source: Psd2Xaml_src.zip (226 kb)
Test media: Tiger.swf (16 kb)  DVDMenu.zip (psd, 989 kb)

It’s Gr-r-r-e-eat!!

Thursday, April 26th, 2007

There are many ways to animate in Flash and the best way is always scripting, or I mean code in AS3.  Flash has grown up quite a bit and now has a very fun coding language in AS3, when programming games or animations scripting is the way to go. You can even do stuff like make a SMTP server/client using mime in it, ok maybe more useful is a binary socket asset loader.

The default mx.transitions classes in AS2 were good, there are much better filter and transition tools now in AS3 but also a bit more bulky than needed and many good Photo Sharing and Video Hosting at Photobucketanimation kits have come along that help people animate with script.  This can be great for team development when architecture is set within everyone’s styles, animation packages for example help to make it easy to have common code so that people can easily understand it. It can be bad when it comes to flash development when you open other’s work if they do not use  at least some standard kits or conventions.

There are a few really excellent animation packages that you should know about.

Photo Sharing and Video Hosting at PhotobucketThe best AS3 animation packages

  1. Animation Package (AS3 kit here)
  2. Tweener (samples here like this papervision3d sample for 3d tweening)
  3. Fusekit and ZigoEngine from MosesSupposes (updated as of late march early april development has started on an AS3 version – not sure of release so its sitting at third)

*All* of these kits allow for total control in a push mechanism to just push animation events onto clips in a dynamic way.  This gives maximum flexibilty for team development and easily changed transitions, or completely random movements.

Fuse has some nice stuff in the works for ColorFX, SoundFX, and even a PaperFX controller for papervision3D.

Thursday, April 26th, 2007

Will McGugan posted an article about subpixel manipulation in Python.  This is possible in other technologies like OpenGL and DirectX but Will has implemented it in Python.

 [check it out]

Here’s a picture of it in action.  Top row with sub-pixel, bottom row without. 

Photo Sharing and Video Hosting at PhotobucketPhoto Sharing and Video Hosting at PhotobucketPhoto Sharing and Video Hosting at PhotobucketPhoto Sharing and Video Hosting at PhotobucketPhoto Sharing and Video Hosting at PhotobucketPhoto Sharing and Video Hosting at PhotobucketPhoto Sharing and Video Hosting at PhotobucketPhoto Sharing and Video Hosting at PhotobucketPhoto Sharing and Video Hosting at PhotobucketPhoto Sharing and Video Hosting at PhotobucketPhoto Sharing and Video Hosting at PhotobucketPhoto Sharing and Video Hosting at PhotobucketPhoto Sharing and Video Hosting at Photobucket
Photo Sharing and Video Hosting at PhotobucketPhoto Sharing and Video Hosting at PhotobucketPhoto Sharing and Video Hosting at Photobucket

Download subpixel.zip  It requires the Numeric library.

Wednesday, April 25th, 2007

[source]

Photo Sharing and Video Hosting at PhotobucketAdobe is in the process of Open Sourcing Flex Under the Mozilla Public License (Mozilla Public License FAQ: http://www.mozilla.org/MPL/mpl-faq.html )

Adobe is announcing plans to open source Flex under the Mozilla Public License (MPL). This includes not only the source to the ActionScript components from the Flex SDK, which have been available in source code form with the SDK since Flex 2 was released, but also includes the Java source code for the ActionScript and MXML compilers, the ActionScript debugger and the core ActionScript libraries from the SDK. The Flex SDK includes all of the components needed to create Flex applications that run in any browser – on Mac OS X, Windows, and Linux and on now on the desktop using “Apollo”.

The timeline to do so will be by the end of 2007.

The source code for the Flex framework is already available within the free distribution of the current Flex 2 SDK. By this summer, Adobe plans to put in place most of the infrastructure (public bug database and public daily builds) required to run the Flex SDK as an open source project. We expect to complete the transition to a fully open source project (source code for the compiler, infrastructure for community contributions, etc.) by the end of 2007.

This is pretty interesting in that it will lead to more applications challenging FlexBuilder but I imagine its largely to get around Open Sourcing Flash altogether.  They will never do that.  But some think that if Adobe were to do this that it would make flash more accepted as an application bulding tool. 

Silverlight Incoming! Flank ‘em

However you might see more backing of Flex.  I know many Flash developers and designers but not many are raving about Flex just yet. In fact its a bit of a confused strategy. It needs more support and this is a very good tactical move.

This is Flex trying to still get in the game

The reality is Flex is not really a player right now.  Flash is the best for interactives, games, learning systems, etc and it completely OWNs online video.  Director owns 3d games on the web.  And .NET, Java, PHP, Rails, Python etc own the web and enterprise.  That is just the state of the industry today. Flex isn’t a top choice right now.

Vector based to be more accepted?

With WPF entering and Flex possibly gaining more ground then vector based desktop apps and websites will be the norm maybe one day, but Adobe and former Macromedia’s sites aren’t even flash or flex.  Its more about applications and as the web becomes even more of a platform for that more trusted than even your own hard drive this may change.  The thing is people like to read content on textual systems like HTML. Vector based RIAs just do not do text correctly yet.  All text should be selectable and able to be searched and copied. Many systems have dual content systems to be indexable but teh text in the flash also needs to be selectable. The closer the usability and readable content in flash comes along maybe this will change.  Vector based interfaces are great for visual and advertising mediums but for most content its not there yet. Flex is starting to bring this in with better HTML support but I think that this move to open source was important to save a falling off initiative or one that had a bit of lag due to the switch from Macromedia to Adobe.  I am still wondering what happened to Director in that hand off.

Wednesday, April 25th, 2007

Today Adobe released the official flash saturation numbers and it’s at 85%, which is safe to go to market with commercial projects. Its been a month since these numbers were ran and anything launching probably in June will be at a 90% penetration rate. Getting tired of upkeeping and working on AS2 libraries, its time for AS3.

Adobe Flash Player Version Penetration

Flash Player 6 Flash Player 7 Flash Player 8 Flash Player 9
Mature Markets1 98.7% 98.1% 96.3% 83.4%
US/Canada 98.6% 98.0% 95.9% 84.0%
Europe2 98.5% 97.2% 95.1% 83.5%
Japan 99.4% 99.4% 98.6% 81.8%
Emerging Markets3 95.9% 91.0% 86.4% 65.4%

Notes

  1. Does not include Flash Player 5 and Emerging Markets.
  2. Supports Adobe Flash Video (FLV).
Flash Player 6 Flash Player 7 Flash Player 8 Flash Player 9
Mature Markets1 98.3% 97.3% 94.2% 55.8%
US/Canada 98.4% 97.6% 94.2% 56.4%
Europe2 98.0% 96.4% 93.0% 59.0%
Japan 98.5% 98.0% 95.6% 50.3%
Emerging Markets3 95.9% 91.0% 86.4% 65.4%

[source]