Posted on 30.07.2010 11:05 am
So I've been working on a little flash game with a good friend of mine in the little spare I've had this summer. He had an idea for a very simple game and we started on a prototype soon after that.
Having never worked in Flash or ActionScript 3.0 we made many strange design decisions from the get go and many of them have been fixed but some haunt us to this day.
One thing that we did from the start was to treat the main flash file as a state machine and each frame a state. That seemed like a pretty solid idea to begin with, but as the size of that code grew, we noticed that this file would conflict way to often in Subversion. So what I did was to take each frame as a function in a larger class and just call the class in the first frame.
var game:Game = new Game(stage, MovieClip(root));
So within the Game class is the state machine that is the game itself. It transitions between the screens and handles the display of or calls the functions that display the items in each screen.
The next thing that needs to be fixed is exactly that. The game class is doing too much, it should only be handling the transitions between states, it should not worry about displaying anything. Some of the screens do this already but not all.
Another fun thing we added was logging of play sessions. This was done by creating a static class that holds all the information that we need to save (usually just integers) and we feed them into a URLVariable variable and send them as a POST to a PHP file on the server.
var url:String = "hg_death.php"; var req:URLRequest = new URLRequest(url); // Set the post variables var variables:URLVariables = new URLVariables(); variables.level = level; // Set the variables into the request req.data = variables; req.method = URLRequestMethod.POST; // Load the death logging request var loader:URLLoader = new URLLoader(); loader.load(req);
Then we reset the data we just sent and the PHP file just receives this data and adds it to a MySQL database.
Then we can monitor what levels are too hard/easy and what skills are being overused/underused.
Also you guys should check out the Game Development Stack Exchange site, it's in Public Beta and could use smart people like you.
- » Archive
Process time: 0.002479 seconds