Archive for the ‘Blog’ Category

Continuing my foray into preparing for collaborative Flash Game Developement, I’ve been thinking a lot about tools, how to set the project up to allow for a maximum variety of skill levels and skill sets to collaborate on the project while trying to keep Flash and Actionscript as much removed as possible.  

In a recent post, I mentioned 3 things I had learned so far about collaborative game dev.  During one of my first “test runs” of the engine ( aka.. one of the ‘more successful failures’ ) I had realized that with a number of people working on the project, most of which have no idea what the inside of Flash looks like.  Which is great!  We all have our strengths, and because they dont know Flash, it just leaves more room for things that *I* dont know.  

The Challenge: 

As the only coder in the little group, my goal is to remove Flash, AS3 and any other technical programs or bottlenecks from as much of the process as I can.  I want to try to remove dependency upon me in the situation, the need for people to come looking for me when they want something changed.  

So I had mentioned earlier that I wanted to externally load (at least now for development ) all assets… Music, Images, xml files containing map and level tile values, etc.  So once you have all of those assets loading in dynamically,  

Thats great, but step ahead to thinking about the intro of your game?  Or the title screen?  what happens to these buttons and sprites and images you’ve posted up when they’re clicked on?  Do they move?  Fade out?  How does your game “feel”?  If this responsibility falls to the designer with no flash experience…?

XML provides the perfect way for them to be able to enter values and control animations by simply editing the text/xml file.  You, as the developer, can easily get XML data and parse through it.  It’s the perfect middle ground.  Now, how do you implement this ‘perfect middle ground?’

Sample XML File:

<animation>
	<info>
		<id>tower</id>
	</info>
	<move>
		<x>100</x>
		<y>100</y>
		<time>2</time>
		<alpha>1</alpha>
		<rotation>0</rotation>
	</move>
</animation>

This is the xml file in the sourcecode.  Ideally, if I keep playing with this idea, this will obviously become a bit more filled out and structured. But for the test here, this xml data is loaded in. You may need to refresh the page if you didn’t see the little image move.

So this is essentially where this test came from… a way to put all of the animation code into an XML file so artists and designers can change values easier.

– Demo

– Source .Zip

28
Apr

AS3 Date Class, PHP and Unix Timestamps

   Posted by: Haelix

This is a real quick post about Unix Timestamps, PHP, and ActionScript 3’s Date class.  When creating a new Date instance, you can pass in a Unix Timestamp into the Date constructor.


var myDate:Date = new Date( unix_timestamp_from_php );
trace( myDate.toString() );  // Invalid Date

When I was working with this, I continually received Invalid date in my output window.  Looking into the matter, if you read php.net’s time() function description and then taking a look at livedocs Date class we’ll quickly see the problem.

From php.net’s time() description:

time

(PHP 4, PHP 5)

time — Return current Unix timestamp

Description

int time ( void )

Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

 

And then from livedoc’s Date() Class:

Date() Constructor    

Constructs a new Date object that holds the specified date and time.

The Date() constructor takes up to seven parameters (year, month, …, millisecond) to specify a date and time to the millisecond. The date that the newly constructed Date object contains depends on the number, and data type, of arguments passed.

 

So PHP time() gives you a Unix Timestamp for the current time in Seconds, and AS3 wants a time in MiliSeconds.

Here’s the fix:


var myDate:Date = new Date( unix_timestamp_from_php * 1000 );
trace( myDate.toString() ); // Tue Apr 28 13:09:32 GMT-0400 2009

OR You could also simply typecast “unix_timestamp_from_php” to type Number() like so:


var myDate:Date = new Date( Number( unix_timestamp_from_php ) );
trace( myDate.toString() ); // Tue Apr 28 13:09:32 GMT-0400 2009

Both of these work, I’m not 100% sure what happens in the Date constructor, but reading further in the Date livedocs, two bulletpoints stand out as to Why sending a String and a Number value give different results:

  • If you pass one argument of data type Number, the Date object is assigned a time value based on the number of milliseconds since January 1, 1970 0:00:000 GMT, as specified by the lone argument.
  • If you pass one argument of data type String, and the string contains a valid date, the Date object contains a time value based on that date.

I’m currently working on a 2D RPG Game Engine ( think Zelda or FinalFantasyII/IV ) in AS3. At the start of this project, as typical projects with friends go, it seems like a completely easy task. “Hey you know AS3… can you write us a quick game engine for this idea we have?” Sure… I’ve finished a simple little game before, I can totally do that.

Take 1:

From previous (limited) game dev experience I know I’ll need to set up a heirarchy of classes to handle Player Characters, Enemies, Scenes, Buttons, etc. So, thinking things out logically (read: noobishly (?) ) the first thing the team will want to see is going to be a the big-picture, visual framework. I sit down and start hammering out a SceneManager to handle scene changes easily. I’ve created an IZFScene interface to standardize the methods of all of my Scene objects for the SceneManager to manipulate. I’ve got my placeholder backgrounds that I tossed into the Flash Library from photoshop ( or MSPaint ) and I’m off and running creating smooth fade-in/fade-out transitions between scenes. The engine process looks like:

Read the rest of this entry »

12
Feb

Useful Air Apps, Reviews, Links

   Posted by: Haelix Tags: ,

For those of you who haven’t seen or come across this yet, I thought I’d pass this along.

AS3 Language Reference Air App

I came across that early last month and it has saved me quite a bit of time. If you have AS3 Livedocs as one of your most visited bookmarks, this app brings livedocs to your desktop so you can load it up when you sit down to work on a project and you don’t have to open browsers and wait for pages to load or even be online at all.

Read the rest of this entry »

February 17th was the date all TV’s in the US were supposed to all… something or other… I dont care.  Here’s the new Idea.  If Congress and … friends… in the FCC can mandate a day for you to lose the significantly inferior signal of analog cable, no matter how attached you’ve become to it… get ready… could we add a little sidenote into this legislation saying…

On the Same Day TV’s go Digital, If you have not joined the latter half of your decade by upgrading from Internet Explorer 5/6 to at Least IE7, you will be at risk for the following:

  • PC initiates self-format to erase your whole fail-worthy pc.
  • all social networking & email sites will cancel and ban your account
  • any amount of money currently held in a bank account you check regularly online will be forfeit to web developers and designers who have spent DAYS bent over backwards trying to accomodate and coddle your blatant disregard for the progress of technology by simply clicking “UPDATE NOW,”
  • you will be formatted from the face of the interwebz!!
  • polariods and hard copies of photos of cherished family members will go missing!
  • your car will develop a strange smell that you’ll never be able to put your finger on nor will you be able to ignore it!

I’m no writer nor politicial anything, so I’m sure someone removed from my current irritation can easily remove the hate from this fine, fine piece of legislation.  In the words of St. John Stewart, “Make it so, monkey paw!”