Thursday, February 19, 2009

Experiment: Building a Flash client in less than 2 hours

I finally unwrapped my copy of Flash and decided it was time to experiment a bit.

Using javascript for Golemizer allowed me to ship the game after a year of development but wasn't of great help for marketing purpose. Most portals and review blogs/websites are focusing on Flash games. Golemizer could have fit some of them but since it's not in the Flash category, it complicates things a bit (it's true that most of these websites will concentrate on casual games but a lot also includes multiplayer games and I've seen Sherwood Dungeon embedded quite often). In the end, a lot of them won't just bother with the game since it's just not made in Flash.

Javascript seems to fit better the PBBG market which doesn't have the same access to visibility (mostly through voting websites but reaching the top takes a lot of votes and to get votes you need visibility which you don't have because you're not at the top of the list...).

Point taken: go where the crowd is. You need to make it easy for them. Don't assume that because your game is "oh so great" that people will come by themselves. You need to go at them and they currently are around Flash games. So Flash it will be for the next project.

So after some research, I finally found two samples that helped me. The first links Flash to a web service and the second is used to read JSON data (used by the web service). Both are using free third party libraries since it seems that Flash thought it would be a good idea to not provide any support for web services in their last version. Go figure...

Using these two samples, I had a basic Flash chat client linked to Golemizer's code less than two hours later. It feels good to know you were right to take some design decisions in the past :-). I changed absolutely nothing to Golemizer's code and the Flash client is actually quite simple.

The only functions from the web service I'm using are:
- doLogin
- sendMessage
- getChat

These commands are pretty much the only one needed to build an interface for Golemizer (add getEvents and you're set). Once you have those, you just need to deal with the data you're receiving from the web service.

So I don't see anything but a chat box but since Golemizer is only using /commands for every actions (move, craft, attack, ...), I can roam the world in text mode calling the function sendMessage("/somecommand with paramaters").

/teleport dock *poof*, the server change the location of my character and I can see what players are saying at the dock. /do 54 and *poof*, I just started a crafting process for a table. /addpart 3465 *poof* I just added some wood to the crafting process. /mute "bad player" *poof*, just muted someone. /smile *poof*, I just sent an emote. I'll stop there cause I could go on all day like that ;-)

So, when will we see a Flash interface for Golemizer? Not yet. I'll first experiment this with the next project (that 90% of mechanics are already coded, it is much more simpler than Golemizer). If I'm satisfied with the final result of this game I might then build a new interface for Golemizer. From what I'm seeing so far, with appropriate time, this shouldn't be so difficult to code.

edit: here's the libraries I used

For JSON it's as3corelib

And for web services


mobeamer said...


Might you be able to point out the two third party tools you used?

Over00 said...

Finished writing this at work and couldn't remember the name but here they are (also edited post):

For JSON it's as3corelib

And for web services