BrainBlitz.org

April 26, 2010

Getting started with FlashDevelop and haXe

Filed under: Programming — Anthony @ 9:37 pm

Now that I’ve reached a bit of a milestone with the pathfinding stuff, I’m taking a break to play with some other items on my to-do list. One of those items is “Give haXe (hex) a spin. haXe is a programming language (very similar to AS3 in syntax) that compiles to multiple targets, including PHP, C++ (code), AS3 (code and swf). It extends AS3 in a couple of ways, and those extensions are the reason I became interested in it in the first place. These include conditional compilation, assertions, apparent execution speed improvements,  and alternative syntax for some unwieldy–yet very frequently occurring–situations involving traversing object members and list elements.

haXe is just a compiler, so of course I had to find a decent IDE, as I’m too un733t to mess with the command line. I’m going with FlashDevelop at the moment, which seems entirely sufficient, andit has an extremely clever name to boot. (That last part was sarcasm, for the less sarcastically perceptive reader). Also, support for haXe is built in. Also, Michael at polygonal labs likes it, and I like every thing Michael likes by default, because he’s smart and wrote such a nice data structure library for AS3 (and haXe).

ANYway, the actual reasonfor this post is that I ran into a couple of complications while getting things up and running. They weren’t covered anywhere in the docs for haXe OR FlashDevelop, so I thought I’d just mention them here.

First, when installing haXe, I received “ERROR = [file_open,C:\Program Files/Motion-Twin/neko/gc.dll]“, followed by “installation aborted.” In my case, simply running the installer with admin privileges fixed it.

Second, although I had the debug version of flash installed, for some reason FlashDevelop was showing an error instead of traces in it’s output. It was compiling and running fine (the swf), but I just wasn’t getting any output. So I downloaded the latest “Projector content debugger” from adobe, then set the path in FlashDevelop ( Tools | Program Settings… | FlashViewer | External Player Path ). Now it’s showing output correctly.

Back to playing…

  • Print this article!
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Yahoo! Bookmarks

April 25, 2010

AS3 Pathfinding and Game Source

Filed under: Programming — Tags: , , , , — Anthony @ 9:11 am

Here is the somewhat-polished version of my pathfinding/game application, all heavily commented in tutorial format for your analyzing pleasure. New to the demo is graphics displaying the internal workings of the pathfinding and collision detection, less brain-dead AI and the ability to add stuff to the map. 

Here is the application: 
Create a few “guys,” click to select, click elsewhere to move. Or add a tower near the guys.
Ctrl+Click to add multiple units; Escape to cancel character selection or drop the current “tool.”
 

Here is the code. 

A few observations: 

  • I  have dubbed my primitive A* pathfinder “AStarOrthogonal” to make it clear: this pathfinder does not work diagonally.
  • I’m still working out some glitches in the “dynamic” collision handling (between mobile units, mainly on head-on collisions). Sometimes the movement isn’t quite right, and sometimes characters end up coinciding. This isn’t a problem with the pathfinder, it’s with the “game” code–specifically the Character “state machine.”
  • The first red cell leading character movement is the square currently tracked by the pathfinder. The leading-leading square is not used at the moment, but I’m experimenting with better collision avoidance by utilizing that future location.
  • If you’re going for something along the lines of the typical, ubiquitous “Tower Defense” game, I’ve already written half the code for you. : )

A couple of technical notes: 

  • This is a learning process for me; keep that in mind. I am but a lowly game programming “hobbyist.” So, if you’re learning from this, don’t assume that everything I’ve done was done the “best” way.
  • If you’re using Flash, CS4 is required by the POLYGONAL data structures library. If you don’t use another IDE (i.e. Flex) and you don’t have CS4, I have at this point only used Singly Linked Lists and Doubly Linked Lists from the library, so it should be easy to find another library that does the trick.

Resources: 

  • The code download includes the POLYGONAL data structure library from http://code.google.com/p/polygonal/wiki/DataStructures. I’ve included the library for convenience, but you might want to check the project home to be sure and have the latest version.
  • As in all my demos, the non-original graphics are from, or are derived from, the work of Azure Flame.
  • Print this article!
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Yahoo! Bookmarks

April 16, 2010

Whinefest

Filed under: Blogorrhoea — Anthony @ 4:10 pm
  • iTunes is a virus.
  • Norton Antivirus is a virus.
  • WordPress is incessantly yelling at me to “Please update now.” I don’t want to have to update software every other day.
  • I bought this little AA battery charger from Radio Shack. The “plug” prongs fold out from the back, such that the charger is flush against the wall. The prongs are positioned such that regardless of whether it’s plugged into the upper or lower outlet receptacle, the other receptacle is covered. ?!?!
  • My mother-in-law recently purchased a large flatscreen TV. The “buttons” on the TV are touch-sensitive spots on the border of the screen. I know minimal interfaces are awesome these days, but with no tactile feedback, in the low-light conditions, when I try to turn off the TV, I usually succeed, but not until I’ve changed the channel, volume and  input as well. Sometimes I sit there running my finger up and down the “button” area, changing all kinds of stuff before it turns off. Come on, GIVE ME SOME MANLY BUTTONS!
  • Blogs are such a horrible format, to have become so popular. They usually are set by default to load a bazillion posts onto the index page, for a massively slow load time. And the navigations is more similar to sequential memory rather than random access, making posts hard to find.
  • I used to think tag clouds were neat, until I realized they are very rarely useful to an actual end user. Who cares which words the author uses most frequently? Or what other people are searching for? Maybe 1%? Tag clouds are not made for someone looking for specific information, and pretty much everyone is looking for specific information.
  • … hm, thought I had another one, but I’m out of whines.

Have a nice, positive day!

  • Print this article!
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Yahoo! Bookmarks

March 25, 2010

New free game music (and other FLStudio stuff)

Filed under: Uncategorized — Anthony @ 8:58 pm

I added a few things to the much neglected music portion of this site: A couple of new FLStudio tutorials and  Three royalty free background tracks (aimed at game use).

  • Print this article!
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Yahoo! Bookmarks
Older Posts »

Powered by WordPress