Thursday, November 15, 2012

Server Code…

Dove into the async tutorial I found the other day: http://www.indieflashblog.com/how-to-create-an-asynchronous-multiplayer-game.html . For the record I have never done anything remotely like this before.

The way it works is with SmartFox, server software that is built to talk with Flash. Downloaded/installed and started parsing through the tutorial text trying to get a handle on how everything works. Unfortunately the indieflashblog tutorial completely skips over how he learned to write serverside code, leaving a little note saying that if you want to learn that go look at SmartFox’s own documentation.

I created a simple MYSQL database on our website, no problem there; I did some PHP server stuff while working for Champlain. The problem that I just smashed my head against for the past three hours was trying to get the client (ie the game) to talk to the server.

Smart Foxes documentation is ok, but flawed because it doesn’t show ALL of the code you need, only snippets. I kept trying to communicate with the server Zone I had created, but it kept telling returning a non-useful error that had 0 google hits….

The other issue is that most of the code written is created on the timeline! WHY?!!! NO ONE DOES THIS! For those who don’t know, writing code directly in flash is a nightmare. You don’t the dozens of useful features like code hinting that have been around for something like 20 years. I code in Flash Development, a program that creates external classes.

Writing AS3 in the timeline and in external classes is almost identical, but every once in a while there is some big differences (importing external libraries, tracing statements, etc.)

Finally ripped open an example file and discovered that, while I was successfully connecting to the server, I was not properly logging in as a guest… which the smartfox documentation failed epically to point out.

So after this minor victory, I’m going home. Brain is too tired to keep coding.

No comments:

Post a Comment