Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c03/h01/mnt/55667/domains/ on line 472

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c03/h01/mnt/55667/domains/ on line 487

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c03/h01/mnt/55667/domains/ on line 494

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c03/h01/mnt/55667/domains/ on line 530

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c03/h01/mnt/55667/domains/ on line 103

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c03/h01/mnt/55667/domains/ on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c03/h01/mnt/55667/domains/ on line 623

Warning: Cannot modify header information - headers already sent by (output started at /nfs/c03/h01/mnt/55667/domains/ in /nfs/c03/h01/mnt/55667/domains/ on line 8 Adventures in Flash Game Programming Mon, 19 Mar 2012 18:45:24 +0000 en How to use Flash CS 5.5, AIR 3.2, and Starling for iOS, iPhone, iPad Sat, 10 Mar 2012 17:57:47 +0000 admin With the newly released AIR 3.2 SDK, you can take advantage of Stage3D and achieve (near) native performance on iOS devices.  As an example, I get a steady 58 frames per second on an iPad 2 when rendering 400 Sprites with Starling (Sprite size: 81×140 pixels).

However, getting Flash ready to export to your iOS device and take advantage of Starling is a bit of a challenge. You need to overcome these two challenges:

  1. Overlay the AIR 3.2 SDK onto Flash CS 5.5
  2. Get your app to use the “direct” render mode, which is required by Starling
Here’s how.
Step One: Overlay the AIR 3.2 SDK onto Flash CS 5.5
Follow these steps

Step Two: Get Flash to use the direct render mode in iOS
Starling requires a render mode of “direct.”
Unfortunately, Flash CS 5.5 doesn’t currently support the ability to choose this render mode when building for iOS.
See here:
The solution is a bit of a hack.
You need to alter your app’s XML file and then make the file read only for PC, or locked on a Mac.
  1. Open your Flash project’s XML file.
    As an example, my FLA is called “starlingIpadTest.fla”, so the app XML file is called “starlingIpadTest-app.xml”.
    See here:
  2. Look for the <renderMode> tag. Set the render mode to “direct” like so:
  3. Make the file read only (PC) or lock it (Mac).
That’s it!
You can now deploy your app and test it on your iPhone or iPad.
How to Overlay AIR 3.2 SDK in Flash CS 5.5 Professional Sat, 10 Mar 2012 00:53:04 +0000 admin Getting the latest AIR SDKs to work with Flash CS 5.5 is a big pain.  The following steps will save you some trouble. (This is for Win 7, but something similar should work for Mac, I suppose)

Note: As always, make backups of anything that you overwrite.
It would be foolish to try this without a way to undo these changes.

1. Download the latest AIR 3.2 SDK here:

2. Extract the SDK

3. Rename the parent folder “AIR3.2″

4. Place the “AIR3.2″ folder in <FLASH CS5.5 DIR>\
(on Windows 7, this is located here: C:\Program Files (x86)\Adobe\Adobe Flash CS5.5)

5. Create a directory named “AIR3.2″ in  <FLASH CS5.5 DIR>\Common\Configuration\ActionScript 3.0\

6. Copy AIR3.2\frameworks\libs\air\airglobal.swc and paste it in the newly created <FLASH CS5.5 DIR>\Common\Configuration\ActionScript 3.0\AIR3.2 directory

7. Navigate to  <FLASH CS5.5 DIR>\Common\Configuration\Players\

8. Paste in the XML files found in this ZIP file:

9. Remove (back up to somewhere) any other iOS XML file that already exists in  <FLASH CS5.5 DIR>\Common\Configuration\Players\
You can have multiple Android XML files here, but not iOS. I have no idea why.

That’s it.
You can now build to iOS with AIR 3.2 and take advantage of Stage3D!

iPhone 4 Shattered Wed, 09 Mar 2011 16:44:17 +0000 admin iPhone 4 + asphalt + 2 feet of free fall == fail

Tiny Wings has now been taken to the next level because there is a real danger of blood loss.

Flash runtime errors show up in the darndest places Thu, 14 Oct 2010 21:37:25 +0000 admin My new HP Officejet 6500 Wireless printer comes with software called “HP Solution Center”.  Apparently, the creators of this app didn’t use the debug version of the Flash Player when developing. ;)

Gamepads for iPhone Sat, 03 Apr 2010 15:53:13 +0000 admin Apple is patenting gamepads for the iPhone and iPad, according to this article.

This is good news because, let’s face it, controlling games with your finger and tilting sucks for just about everything besides driving games, puzzle games, and gimmicky apps.

Many types of games are just NOT possible.
Megaman, Super Mario Bros., and any game that requires more precise control than can be achieved with a hot dog.

Attempts have been made to port some arcade classics, and most are terrible.

Putting a “controller” on the touch screen is just plain awful.

The bad news, or course, is that not everyone will have the gamepad.  And even if you have the gamepad, you’re not likely to have it with you every time you want to play a game.  Thus, games will have to be designed to support the standard control scheme anyway.

The best scenario would be to have actual physical buttons on the iPhone.  However, this will never happen.  Apple has spent a lot of money and energy to convince consumers that there is no need for physical buttons.

iPhone 4 to support Flash! Thu, 01 Apr 2010 15:16:01 +0000 admin This just in.
Wait for it….

iPhone 4 will support Flash, along with the iPad.

Just kidding.
April Fools, you idiot.

Unity 3.0 2D Sprite Engine Wed, 24 Mar 2010 18:32:45 +0000 admin The upcoming Unity 3.0 will have a 2D Sprite Engine, as you can see from the press release:

The press release makes it sound a little like the sprite engine is specific to the iPhone, but this is not the case.  You can see the “inside” info here (top secret):

Creating 2D games is currently very clunky in Unity.  Basically, you have to billboard textures onto planes or boxes, etc.  There is no hit detection for pixels.

In case anyone misses the point, a 2D sprite engine makes Unity a one stop shop for game development.  This effectively provides competition to Flash and Silverlight, as well as the folks at Garage Games, and many others.

Being able to write games in 2D or 3D, and deploy to the PC, Mac, Xbox 360, Playstation, iPhone, Andriod, and Atari 2600… where do I sign up?

Instantiating a prefab from the library in C# with Unity 3D Sun, 09 Aug 2009 18:05:58 +0000 admin Unity 3D is really geared toward visually building your game through use of the Unity 3D editor. However, there are times when you want to instantiate a prefab that you don’t already have in the Scene.

Instantiating a prefab from your library is easy, once you know how. Figuring out how is a pain. The biggest quirk is that your prefab must be located in a directory called “Resources” if you want to instantiate it using C#.

Here are the steps.

1. Make sure you create a directory called “Resources” and place it in your Assets/ directory.
2. Create a prefab. Let’s all it “FooPrefab”.
3. In C#, instantiate the prefab as follows:

GameObject go = Instantiate(Resources.Load("FooPrefab")) as GameObject;

Why does the prefab have to be placed in a directory called “Resources”.
Who knows?

Using C# with Unity 3D to achieve code completion (intellisense) Sat, 08 Aug 2009 15:48:59 +0000 admin I’ve been playing around with Unity 3D lately, and its pretty awesome.  Its not very difficult to make the leap from Flash to Unity.  However, one detractor to Unity is its poor coding environment.

As a Flash programmer, I’m very spoiled by several of the development environments available to me.  FlashDevelop, Flex, etc. all provide intelligent editors that give me code completion.  Unity’s built in editor does not have this feature.  Once you get used to code completion, you can never go back to a plain text editor!

The good news is that you can use Visual C# 2008 Express for all of your Unity coding needs, and its totally free!  Thanks, Bill Gates.

Below are the steps to set up your environment.  Have fun.  Don’t say I never gave you anything.

One time setup:

1. Download Visual C# 2008 Express for free:

2. Install it.  ;)

3. Download the following file, which is needed for tool tips as you edit in C#.
Place the 2 XML files here:
C:\Program Files\Unity\Editor\Data\lib
(or wherever you installed Unity)

Repeat for each project:

1. When you create a new Unity 3D project, you need to create a new C# project somewhere in the Assets/ directory.  It can be right in Assets/, or you can make a sub directory.  Making a sub directory might be cleaner as C# will create solution files, etc.  Use “Empty Project” as your project type in C#.

2. Add a reference to the Unity dll files in your C# project.
In C#’s Solution Explorer panel (on the right), right-click the project and choose “Add Reference”.
Browse to and add UnityEngine.dll.
(you can add the editor dll as well if you are going to write editor code)

3. Create new class files from within C#.  If you do it from Unity, they don’t show up automatically in your C# project (there is probably a way to add them, but I don’t know it).

That’s it!
Code completion, tool tips, hints… it’s all there.

Book: ActionScript for Multiplayer Games and Virtual Worlds Wed, 29 Jul 2009 16:55:10 +0000 admin Jobe Makar’s new book, ActionScript for Multiplayer Games and Virtual Worlds, will be available this Monday (August 3rd).  I’ve already read the book and it’s fantastic!

ActionScript for Multiplayer Games and Virtual Worlds

I really wish something like this had been available years ago.  I create lots of multiplayer games and virtual worlds.  This book would have saved me tons of time and effort.

In addition to being a fan of Jobe’s books, I had the pleasure of contributing to this one.  Jobe did me the honor of having me to write Chapter 11: Cooperative Game Play.

The chapter discusses various cooperative game concepts.  Also, I created a fully working multiplayer game to go along with the chapter: Super Blob Brothers (Thanks go to Scott Smith for writing all of the server side code to support the game).  Of course, the book comes with the full source code for the game.

In Super Blob Brothers, two players must help each other complete each level by navigating from the starting point to the Goal Pad.  The game is unique in that cooperation is required.  No level can be completed by a solo player.

Super Blob Brothers

Obstacles include rocks, laser gates, and laser towers.  Rocks can only be pushed by two players working together.  One player has the ability to defend against lasers.  The other player has the ability to disable laser towers.

Other games in the book include a real-time tank game and a fully working virtual world example.

Be sure to purchase the book as soon as possible!  On a scale of 1 to 10, I’d give it an 11.