Wednesday, October 7, 2009

Delays, Delays, and Windows 7

Gah. All I want to do is get back to this iso engine and everything has gotten in my way. The client is unhappy with using sharedObjects out of fear of the sharedObject being cleared and he'd lose his entire Flibrary record database. So I decided I'd have to move to using php scripts to write local files, but I don't have the cash to renew my website domain. So, as an XP pro user, the client mentioned IIS to me. Sounded like a good fix but I was using XP Home which doesn't have IIS. So I had to upgrade to Windows 7. (FANTASTIC OS in my opinion, but that's another post for another day.) Now I have IIS and school continues to get in the way of actually sitting down to wrap up this application. Not to mention that Windows 7 HATES Flash CS4 Professional and gives me all sorts of nice errors to deal with. More delays. Ugh.

Tuesday, September 15, 2009

Small delay for a side project....

I've had to halt progress on this application for a few days. My finace's brother needs me to write an app for his living room television that he runs his movie server on. My goal was to mimick Libra, his original movie library app:




I'm probably 3/4 of the way done with my own copy, but it's so time consuming because I'm scripting all the menu buttons, which just takes time. Here's my result thus far:
It has to be able to store his entire 1k+ movies into a shared object on his local drive, as well as launch the applications and do lookups for all the information. I have been able to get all the information from writing custom page scraping code for both Yahoo! movies and Google Images, but it also allows a user to specify their own image from the local drive/external url.

I just want to work on my iso app, but my compensation for the project is too hard to turn down.

Saturday, September 12, 2009

AS3... a fresh start

I never wanted to migrate to AS3. It's such a spin from my comfy chair in AS2-land that I refused all coersion to migrate. That is, until I started another isometric project. For anyone who doesn't already know, I'm the king of procrastination. My flash projects folder outnumbers my completed games folder almost four to one. Typically, I get a good idea in my head and start coding it, but I always hit a wall when it comes time to do graphics and sound effects because I am novice at best in both categories.

This isometric game plan has been nagging at me for almost two years. I've got bits and pieces of code scatted throughout half a dozen notebooks in my desk, but I always knew I couldn't polish the game because I don't have the graphic hand to make the game look nice.When I started this project last weekend, I started it in AS2. Within hours I haid laid out a basic system for map generation, and I could grind out a nice map (not including player interaction or interactable objects; just tiles) in a few hours.

I started doing the math and wondered how far I could push the limits of AS2 knowing it had it's limitations. I found out that with an AS2 isometric engine, I could -barely- push between 1200-1500 tiles on a single map. Damnit, another wall: performance. Against all the will I could muster, I started looking into AS3...

My first test with AS3 was the language. It's completely different than AS2. Adding a movie clip to the stage used to take me ten seconds in AS2; in AS3 the first sprite to display on the stage took me thirty-five minutes. Flash forward to now though, and I can't BELIEVE I didn't migrate sooner. I can now pushing 1800 tiles to the screen and still maintain between 40-50FPS (down from 61 stage framerate). That kind of power was overwhelming! Not only did I find myself giggling like a little girl, but I vowed to never, EVER write another application in AS2.

So, after I got the new engine laid out, I took to writing a tile system. Nothing fancy, but I wanted something dynamic and simple to generate a tile from a single number. In AS2 we used to a gotoAndStop() engine, but that wasn't going to cut it for me because I wanted to be able to have a different look to each room from a spritesheet. Furthermore, that meant that I was going to have to break a tile down into each "piece" or "face". So now what do I do? You guessed it: Base 2. Base 2 allowed me to set each face to a specific number, rangine from 1-512:

  • 1 - Bottom
  • 2 - North West Wall
  • 4 - North East Wall
  • 8 - South East Wall
  • 16 - South West Wall
  • 32 - North West Ramp
  • 64 - North East Ramp
  • 128 - South West Ramp
  • 256 - South East Ramp
  • 512 - Top
Using this, I worked with Chris from Flashkit and developed a system to determine what base 2 numbers went into any specific combination. With those numbers, using each side only once, you can generate a number anywhere from 1-1023. So my TileMaker class takes in the number 527, and kicks me back 512, 8, 4, 2, and 1. I translate these numbers back into single digit numbers from 0-9 and pull an object from an array that houses all the data I need to create a new child Sprite of the tile with correct depth, matrix, and coordinates.

From there it was only a matter of piecing it all together into a simple map editor that you can see here. All the controls are found using the Help button at the top. To erase a tile, uncheck all the face check boxes in the right panel. Also, don't press Render Map twice... kind of a last minute bug I forgot to remove. If you press it twice without closing the first render window, you will be unable to close the bottom window and will be forced to refresh your browser.