Status update on my little game project.
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.
1 2 Like it or hate it? - Comment (1)
What are you doing in front of the computer all day?
Posted on 27.07.2010 02:15 am
I found out recently that I have quite a few non programming readers and I've wanted to do a "What is programming?" post for a while now. I also found out that writing about programming without using programming as an example is tricky but I hope this helps.
Lets start with my favorite quote. It's from the book "Dirk Gently's Holistic Detective Agency" by Douglas Adams.
If you really want to understand something, the best way is to try and explain it to someone else.
That forces you to sort it out in your mind.
And the more slow and dim-witted your pupil, the more you have to break things down into more and more simple ideas.
And that's really the essence of programming. By the time you've sorted out a complicated idea into little steps that even a stupid machine can deal with, you've learned something about it yourself.
I love this quote, since it not only explains programming in a simple way, but it does so in a much better manner than I could ever do. It also sheds a light on how you can learn more about any subject.
Another great quote is by Ernest Rutherford.
An alleged scientific discovery has no merit unless it can be explained to a barmaid.
So this is for all you barmaids out there.
What do you do every morning? If I asked you that, a common answer might be that you wake up, take a shower, brush your teeth, eat breakfast and get dressed.
These are all concepts that we understand, because at some point in life, we were taught these things. So someone defined for us what taking a shower was, and since then, we know what taking a shower is.
But programming lies within that definition. You don't go into a shower consciously thinking about every step. You probably did at first or when you changed the definition of a shower to include or exclude some steps, but otherwise you go about your business of showering with little thought.
So what is within this definition? We could say that a standard showering definition is to get reasonably wet, apply soap to body until clean and then rinse the soap off... and perhaps repeat but that is a joke for later.
Three steps that we understand just as well as the original shower definition. So lets look at the first step in taking a shower. Getting wet.
Are there any steps in getting wet in a shower? Well yes. First you might have to remove any article of clothing that you might be wearing, since you don't want to make them wet as well. Then you have to enter the shower and turn the faucet to some level that is not too hot or cold, and then let the water cover your body.
You might be thinking. "Isn't this getting a little too specific?" and you'd be right. But for programming, you can never be too specific. Because if you had to program these steps for some sort of a showering robot, then you would have to specify every single step of taking a shower to the smallest detail, or else the robot will not perform correctly. This is going back to the stupid machine quote.
When creating programs you can not take anything for granted. In some programing languages you might have access to a set of tools that make your life easier and solving the task simpler but those tools only exist because someone methodically defined them for your benefit, and it is very likely that he also used some other tools that someone created to make his life easier.
We can keep going like this until we hit the core of the system. But programmers rarely work at such a low level since it can be very time consuming. They work with simpler tools that have been abstracted in such a way that they only have to focus on their current task.
So when building your showering robot. Someone else might have created some method of removing a single article of clothing and it is your task to program in when the robot should do this, in what order and you might call this functionality "Remove Clothes" for someone else to use to simplify the removal of clothing.
You might say that the core of programming is to solve problems. But the way that we do that is by creating systems and tools that aid us in solving those problems and hopefully help others in solving theirs.
Oh and if you're wondering about the project I talked about in the last post, you can ask Tom Cargill and Jon Bentley why I haven't talked about it yet.
0 4 Like it or hate it? - Comment (1)
Process time: 0.013111 seconds