Showing posts with label flash. Show all posts
Showing posts with label flash. Show all posts

Saturday, May 15, 2010

Facebook: Facts You Probably Didn’t Know

In case it was not obvious that FaceBook is a viable platform for games (and everything else):

Facebook: What You Probably Didn't Know
[Source: MashableMashable.com]

Thursday, May 13, 2010

FaceBook Games that had something of interest

Just a quick list I made.

FarmVille (by Zynga)- http://apps.facebook.com/onthefarm/

Other than the fact that is likely the most profitable game on FB now.

As a sandbox game, it has no real objectives other than to earn the ability to decorate your virtual farm with more options.

It has led to numerous clones, including clones made by Zynga themselves like CafeWorld, YoVille, etc. It was also a clone of another similar farming game.



Mafia Wars (by Zynga) - http://apps.facebook.com/inthemafia/

Instead of using Flash, it only uses HTML. Some of its more interesting features include achievements, trading, collecting, frequent new content. It has also inspired a lot of clones which are all very similliar.



Castle Age (by Jelsoft Enterprises) - http://apps.facebook.com/castle_age/

One of the better clones of Mafia Wars. It added cooperative play against limited duration enemies which sometimes involved over 200 friend and friends-of-friends.



WarStorm (by Challenge Games) - http://apps.facebook.com/warstorm/

A collectible card game on FB using Flash.



Who has the Biggest Brain? (by PlayFish, Electronic Arts) - http://apps.facebook.com/biggestbrain/

Make nice use of Flash to create a "brain training" game.



MindJolt Games (by MindJolt Games) - http://apps.facebook.com/mindjolt/

Quite a large collection on flash games that are integrated with FB to challenge friends' high scores.



Whirled Games (by Whirled Games) - http://apps.facebook.com/whirled/

Another collection of simple flash games.



Battlestations (by TYLER Projects) - http://apps.facebook.com/battlestations/

Singapore's first Facebook MMO, with a monthly sales of over $50,000.



Any others that you think that are worth mentioning?

Wednesday, September 16, 2009

Review: Red Bull Soap Racer

A while back I got demoralized when I saw how Papervision3D slowed down when building complex scenes. After taking a look at this racing game, I realized that's any slowness I noticed previously in other games is due to unoptimized/inefficient use of Papervision3D.

The game is a cartoon-ish kart racer where you can fully customize your kart and then race with other friends online. Even race tracks can be customized too. While the game concept is not new, this may be the first time that it has been done using flash.



Our friends at Less Rain have set once again the benchmark for 3D games in Flash, using the powerful combination of Papervision3D and Box2D. Check out their blog for more info.

[Source: papervision3d.org]


FYI, they used Box2D for physics as Papervision3D does not include physics.


Another thing worth mentioning is that it is brought to us by Red Bull. This is what I call a good advertisement (and something that I will "watch" repeatedly).

Saturday, July 25, 2009

Using Actionscript for 3D

Recently, I have toying around with 3D in flash. There are several frameworks to produce 3D graphics (e.g. Papervision 3D, Sandy, Away3D, Yogurt3D, FIVe3D, etc) which you can use together with other frameworks for physics (Wow-Engine, JigLibFlash, box2dflash, APE), object distortion (AS3Dmod), augmented reality (FlarToolKit), etc.

When working, I quickly realized that using primitive shapes to build a 3D scene with ActionScript was only useful to a certain point. To supplement this, some allow the importing of COLLADA models, which is a standard that represents models with an XML file and an image used for texture mapping.

When searching for some models to use in my projects, I stumbled on Google's 3D Warehouse (a place that stores 3D models that people created) and SketchUp (a tool to create 3D models).


[Source: papervision2.com]

Hope you found that interesting.

Thursday, July 9, 2009

Flash Kit Community Forums

I recently been spending a lot of time on the Games sub-forum on the Flash Kit Community Forums.

There are lots of existing and new Flash developers discussion making games there.

Check it out if you have time.

Monday, June 29, 2009

Using FaceBook API from ActionScript

About two month ago, FaceBook announced it's Open Stream API (also known as Facebook Connect) that allowed applications to interact with FaceBook and replicate most of it features.

To demonstrate this, they got their partner, Adobe to create Facebook for Adobe AIR, which is an application that runs on your desktop. You log in with your Facebook account and can then read your News Feed and publish content to your Wall and friends' News Feed.

The source code for this application is publicly available and I recently took a look at it.
(UPDATE: there is now a project on Google Code for it too)

Of particular interest is how it communicate with FaceBook:


var request:URLRequest = new URLRequest("http://api.facebook.com/restserver.php");
request.contentType = "application/x-www-form-urlencoded";
request.method = URLRequestMethod.GET;
request.data = urlArgs; // a flash.net.URLVariables object


But all this is nicely encapsulated for you in the "fb" package.

Some uses would be to upload screenshots and post achievements in Flash games directly to your FaceBook wall. Or it can be used to allow easy multiplayer game matchmaking with your friends.


The source code from this application also show some advanced ways to display HTML formatted text using ActionScript (and Flex). Thus, its a rather nice example.


Also, here is a tutorial (from Adobe) that walks beginners like me on how to register a FaceBook application and get its API key, however it uses Flex instead of Flash.

Sunday, May 17, 2009

Tutorial: Simulating inertia in 2D with Flash

I was playing around with ActionScript 3.0, in particular making an object accelerate in 2D to simulate inertia. Below is a partial snippet of code that I ended up using:

public var thrust:Number = 1;
public var decay:Number = .9;
public var speed:Number = 0;
public var xSpeed:Number = 0;
public var ySpeed:Number = 0;
public var maxSpeed:Number = 15;
public var xThrustPercent:Number = 0;
public var yThrustPercent:Number = 0;

public var leftkeyPressed:Boolean = false;
public var rightkeyPressed:Boolean = false;
public var upKeyPressed:Boolean = false;

// Respond to keyboard presses
stage.addEventListener( KeyboardEvent.KEY_DOWN, keyPressHandler );
stage.addEventListener( KeyboardEvent.KEY_UP, keyReleaseHandler );

// Update movement every frame
addEventListener( Event.ENTER_FRAME, enterFrameHandler );

protected function keyPressHandler( event:KeyboardEvent ):void
{
  switch( event.keyCode )
  {
    case Keyboard.LEFT:
      leftKeyPressed = true;
      break;

    case Keyboard.RIGHT:
      rightKeyPressed = true;
      break;

    case Keyboard.UP:
      upKeyPressed = true;
      break;
  }
}

protected function enterFrameHandler( event:Event ):void
{
  if( leftKeyPressed )
  {
    rotation -= 10;
  }
  if( rightKeyPressed )
  {
    rotation += 10;
  }
  if( upKeyPressed )
  {
    // Calculate how much thrust to apply to
    // x and y based on the rotation of the object
    xThrustPercent = Math.sin( rotation * ( Math.PI / 180 ) );
    yThrustPercent = Math.cos( rotation * ( Math.PI / 180 ) );

    // Apply the trust to x and y
    // thus accelerating the object
    xSpeed += thrust * xThrustPercent;
    ySpeed += thrust * yThrustPercent;

    // Maintain speed limit
    speed = Math.sqrt( ( xSpeed * xSpeed ) + (ySpeed * ySpeed ) );
    if( speed > maxSpeed )
    {
      xSpeed *= maxSpeed / speed;
      ySpeed *= maxSpeed / speed;
    }
  } else {
    xSpeed *= decay;
    ySpeed *= decay;
  }

  // Move object based on calculations above if ship is visible
  y -= ySpeed;
  x += xSpeed;
}


Obviously, the keyReleaseHandler (which is not shown) does the opposite of keyPressHandler.
Also, you can add a brake functionality to the down arrow if you wish.

Some interesting maths used:

sin( 2700 ) = -1
sin( 00 ) = 0
sin( 900 ) = 1

cos( 00 ) = 1
cos( 900 ) = 0
cos( 1800 ) = -1


Since rotation specifies the rotation of the object in degrees and ActionScript's trigonometric functions (e.g. sin, cos, etc) use radians, you have to convert between the two.

radians = degress * ( PI / 180 )


Lastly, calculating the diagonal distance is done using this simple formula we all learn in school.

diagonal distance = sqrt( x2 + y2 )

Friday, May 15, 2009

Tutorial: Handling touch gestures in Flash Lite

I came across this interesting tutorial on how to handle touch gestures made famous by Iphone in a Flash Lite application.

Here's the code from the tutorial:

var startX:Number;
var startY:Number;
var endX:Number;
var endY:Number;

var gesturesListener:Object = new Object();

gesturesListener.onMouseDown = function()
{
  startX = _root._xmouse;
  startY = _root._ymouse;
}

gesturesListener.onMouseUp = function()
{
  endX = _root._xmouse;
  endY = _root._ymouse;

  checkGesture();
}

Mouse.addListener(gesturesListener);

// minimum length of an horizontal gesture
var MIN_H_GESTURE:Number = Stage.width / 3;
// minimum length of a vertical gesture
var MIN_V_GESTURE:Number = Stage.height / 3;

// flags for each kind of gesture
var UP_TO_DOWN:Number = 1;
var DOWN_TO_UP:Number = 2;
var LEFT_TO_RIGHT:Number = 4;
var RIGHT_TO_LEFT:Number = 8;

function checkGesture()
{
  var xDelta:Number = endX - startX;
  var yDelta:Number = endY - startY;

  var gesture:Number = 0;

  if(xDelta > MIN_H_GESTURE)
    gesture |= LEFT_TO_RIGHT;
  else if(xDelta < - MIN_H_GESTURE)
    gesture |= RIGHT_TO_LEFT;
  if(yDelta > MIN_V_GESTURE)
    gesture |= UP_TO_DOWN;
  else if(yDelta < - MIN_V_GESTURE)\
    gesture |= DOWN_TO_UP;
  if(gesture > 0)
    handleGesture(gesture);
}

function handleGesture(gestureFlags:Number)
{
  if(gestureFlags & LEFT_TO_RIGHT)
    trace("left to right gesture");
  if(gestureFlags & RIGHT_TO_LEFT)
    trace("right to left gesture");
  if(gestureFlags & UP_TO_DOWN)
    trace("up to down gesture");
  if(gestureFlags & DOWN_TO_UP)
    trace("down to up gesture");
}


It was from a mobile games development blog, Jappit which covers all the different platforms, namely J2Me, Flash Lite, Symbian, Iphone and Andriod.

Thursday, May 7, 2009

Flash Lite

Adobe Flash Lite is a highly optimized implementation of the Flash runtime for mobile phones, consumer electronic devices, and Internet-connected digital home devices.

Additionally, Flash Lite 3 allows developers to quickly create engaging applications, accelerate time to market, and increase customer adoption. With the new distributable player solution from Adobe, developers can directly distribute rich mobile applications with the latest Flash Lite player to millions of smartphones.

[Source: Adobe.com]
The popularity of Flash Lite is much less that that of J2ME which is the current dominate market holder for mobile games (with IPhone currently second, but increasing rapidly).

This is mostly due to the limited number of mobile phones that support it (mainly high end Nokia and Sony Erickson models) and those that do support it likely only support the older releases (e.g. Flash Lite 2.0, 2.1, etc).

Hopefully this will change, as the power of it and ease of development is far superior to J2ME from my point of view, hence the limited support for it currently. But as time goes by, phones become more powerful, and I expect J2ME to lose it majority.

Here's a Flash Lite game, as you can see it is also playable using any Flash Player on a browser. Notice the numbers on the buttons, they allowing using a mobile phone's number pad to play.


Tic Tac Toe (Flash Lite, v1.0)
[Source: ClickGamer.com]




Anyone has any opinions on this? If so, please do comment as I would like to hear what you think.

Wednesday, May 6, 2009

Flash Animation Tutorial by NCH85

While surfing the internet, stumbled on a two-part tutorial on animating using Flash.




[Source: DeviantArt.com]



If you're a newbie to Flash like me, they you may find them useful.
I really loved the animation, and the script was good too.

I especially liked how he showed the way he drew the rabbit with the different Flash tools in part 2.

Tuesday, April 21, 2009

Bought two books to learn Flash

I recently decided to learn (self study) Flash after seeing a web site make rather interesting web game, that allowed two players across the internet to play a game against each other, while storing ranking and other information (in a database I presume) which was displayed using HTML.

The current version is Adobe Flash CS4, which uses its own scripting language, ActionScript 3.0. So I went down to the local IT Mall, Funan Center and bought two books on it.

The first book was Flash CS4 "All-In-One" For Dummies (S$69) which I am currently reading. It is a very easy to read book to give me a general background on flash. As I have never used Flash before, I found it helpful, but I think any existing user would find it too simplistic. The jokes it had did not always make me laugh, but together with the colorful pictures, helped break the monotony of reading through each individual tool and option.

The second book ActionScript 3.0 Game Programming University (S$61) was purely on using ActionScript 3.0 with source code of examples, including some games that are available from its companion website, FlashGameU.com. That should be a lot more useful to what I plan to do.

In this day and age of downloading books to read, you may ask why did I buy them. Well, I personally like to support stuff I like. Also, I prefer reading actual books instead of binded printouts or photocopies.



In related news yesterday, Adobe is planning that the digital living room will likely support Flash and Flash-based applications at the end of 2009.

Specifically, Adobe has convinced a wide swath of leading technology companies to support a new, optimized Flash Lite runtime for a number of chips that will form the foundation of connected TVs, DVD players, game consoles, and digital media adapters.

[Source: PCMag.com]