Friday 27 March 2009

Naming Conventions and Asset Management from Photoshop via Ruby into Flash

When I was creating assets for my Bread Bin game I made sure to name things usefully at the earliest possible stage.

So here's how my PSD looked:



This allowed me to use Photoshop's "Export Layers to Files..." script to create a folder of images in my (sprouts-based) Flash project's assets folder.





Note that when exporting to PNG files, the layers can be automatically trimmed, resulting in a folder like this:


The next task was to get rid of the leading numbers in the file names (I wanted total purity of file name :) ), a task for a bit of Ruby:

That renames all of the files in a folder stripping out the first 6 characters.

The next step was to resize the assets to something appropriate for my app. I didn't want to do this by hand and I assumed I'd change my mind depending on how the image size affected the gameplay, so I created a rake task in my project's rakefile, like so (you could use Automator, but I like the command line and have Git and ImageMagick installed and working!):



I'd created my folder of large images and committed it to my project's git repository. Then I knew that any time in the future I could revert back to those original images and rescale them using a command like "rake resize_assets scale=40%".

Next, I needed to embed these assets into my Flash file. Using code all the way, of course (you'll never see me voluntarily start up the Flash IDE...).


Running "rake assets" produces an AS3 class like this:


So then I have Bread class that looks something like this:


And now my method that returns a new Bread model with a random asset looks like this:


So now, asset management is done on the filesystem, and to 'commit' my asset changes I just run "rake assets" and my ActionScript class is brought up to date, and I get to use the French words for the breads, simply because I was sure to name my original Photoshop layers usefully!

Here's the game again, anyway:
Bread Bin game

2 comments:

  1. Hi! What a great post! You have such a good point of view. It is very well said. Thank you so much for sharing this informative post and for sharing your posts with us. I'll be looking forward for your other posts as well. Keep it up and more power to you. Asset management refers to any system that monitors and maintains things of value to an entity or group. It may apply to both tangible assets such as buildings and to intangible concepts such as intellectual property and goodwill. Asset management is a systematic process of operating, maintaining, upgrading, and disposing of assets cost-effectively. Alternative views of asset management in the engineering environment are: The practice of managing assets to achieve the greatest return (particularly useful for productive assets such as plant and equipment), and the process of monitoring and maintaining facilities systems, with the objective of providing the best possible service to users (appropriate for public infrastructure assets). Investing without a plan or strategy can be a recipe for disaster. At Cabot Money Mangement, we believe that determining the proper asset allocation plan for our clients starts by understanding their needs. Do they need to save for retirement? How about college savings for their kids? Are they interested in allocating a portion of their funds to benefit their children in the future? The mix of investments in a client’s portfolio will contain a variety of investment vehicles tailored to each client’s goals, timeframe and tolerance for risk. Asset Management Boston

    ReplyDelete
  2. Thank you for sharing. I think it’s important to seek financial planning services for help with outlining investment objectives and assessing risk tolerance in an effort to develop an investment strategy.

    investment management Kerrville, TX

    ReplyDelete